diff options
Diffstat (limited to 'mainwindow.cc')
-rw-r--r-- | mainwindow.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/mainwindow.cc b/mainwindow.cc index 5c27145..bba19cc 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -42,11 +42,9 @@ MainWindow::MainWindow(QWidget *parent) : ui->notebookTree->header()->setSectionResizeMode(1, QHeaderView::Fixed); ui->notebookTree->header()->setSectionResizeMode(2, QHeaderView::Fixed); ui->notebookTree->expandAll(); - ui->notebookView->setVisible(false); ui->paperReplayView->setModel(_replayModel); ui->paperReplayView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); ui->paperReplayView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed); - ui->paperReplayView->setVisible(false); Phonon::createPath(_media, _mediaOutput); _media->setTickInterval(500); ui->replaySlider->setMediaObject(_media); @@ -85,9 +83,8 @@ void MainWindow::closeNotebook() _curPenName.clear(); _curNotebookName.clear(); _replay->close(); + ui->pane2Stack->setCurrentWidget(ui->notebookView); ui->notebookView->setNotebook(QString()); - ui->notebookView->setVisible(false); - ui->paperReplayView->setVisible(false); } void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) @@ -105,7 +102,7 @@ void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) _replay->open(replayDir, 0); _replayModel->refresh(); - ui->paperReplayView->setVisible(true); + ui->pane2Stack->setCurrentWidget(ui->paperReplayView); } else { QString nbDir = _notebooks->notebookDirectory(_curPenName, _curNotebookName); @@ -113,7 +110,7 @@ void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) ui->notebookView->setPaperReplay(_notebooks->paperReplayDirectory(_curPenName)); ui->notebookView->setNotebook(nbDir); - ui->notebookView->setVisible(true); + ui->pane2Stack->setCurrentWidget(ui->notebookView); } } @@ -173,8 +170,8 @@ void MainWindow::handleNotebookSelected(const QModelIndex &index) // Get column 0, which corresponds to notebook name QModelIndex nb = _notebooks->index(index.row(), 0, parent); - openNotebook(_notebooks->data(parent, Qt::DisplayRole).toString(), - _notebooks->data(nb, Qt::DisplayRole).toString()); + openNotebook(_notebooks->data(parent, NotebookModel::FileNameRole).toString(), + _notebooks->data(nb, NotebookModel::FileNameRole).toString()); } void MainWindow::handleNotebookRowsInserted(const QModelIndex &index, int start, int end) |