diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-14 08:34:16 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-14 08:34:16 -0300 |
commit | c5590f835aba2cd4d0b622b0c63ec4f5796d9548 (patch) | |
tree | c0f06e3df3777340bb85dbacf1c043d53c9618ec /qt-ui | |
parent | b0374047dd6a31d8b16c6991ee0ffc51c198569e (diff) | |
download | subsurface-c5590f835aba2cd4d0b622b0c63ec4f5796d9548.tar.gz |
Fix the focus issues, load a profile when load a file.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 60a4623c7..0b7f9f25d 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -36,6 +36,8 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), sortModel->setSourceModel(model); ui->ListWidget->setModel(sortModel); setWindowIcon(QIcon(":subsurface-icon")); + connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); + ui->ProfileWidget->setFocusProxy(ui->ListWidget); QModelIndex firstDiveOrTrip = sortModel->index(0,0); if (sortModel->index(0,0, firstDiveOrTrip).isValid()) @@ -43,7 +45,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), else ui->ListWidget->setCurrentIndex(firstDiveOrTrip); - connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); + ui->ListWidget->setFocus(); } void MainWindow::current_dive_changed(int divenr) @@ -91,6 +93,13 @@ void MainWindow::on_actionOpen_triggered() model = new DiveTripModel(this); sortModel->setSourceModel(model); ui->ListWidget->sortByColumn(0, Qt::DescendingOrder); + + QModelIndex firstDiveOrTrip = sortModel->index(0,0); + if (sortModel->index(0,0, firstDiveOrTrip).isValid()) + ui->ListWidget->setCurrentIndex(sortModel->index(0,0, firstDiveOrTrip)); + else + ui->ListWidget->setCurrentIndex(firstDiveOrTrip); + ui->ListWidget->setFocus(); } void MainWindow::on_actionSave_triggered() |