summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-14 08:34:16 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-14 08:34:16 -0300
commitc5590f835aba2cd4d0b622b0c63ec4f5796d9548 (patch)
treec0f06e3df3777340bb85dbacf1c043d53c9618ec
parentb0374047dd6a31d8b16c6991ee0ffc51c198569e (diff)
downloadsubsurface-c5590f835aba2cd4d0b622b0c63ec4f5796d9548.tar.gz
Fix the focus issues, load a profile when load a file.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/mainwindow.cpp11
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()