summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index e8fe80460..56ae64b0c 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -32,14 +32,17 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
sortModel(new QSortFilterProxyModel())
{
ui->setupUi(this);
+ readSettings();
sortModel->setSourceModel(model);
ui->ListWidget->setModel(sortModel);
setWindowIcon(QIcon(":subsurface-icon"));
-
connect(ui->ListWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(dive_selection_changed(QItemSelection,QItemSelection)));
-
- readSettings();
+ 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);
}
void MainWindow::on_actionNew_triggered()
@@ -343,11 +346,6 @@ void MainWindow::readSettings()
}
ui->ListWidget->collapseAll();
ui->ListWidget->expand(sortModel->index(0,0));
- 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);
settings.endGroup();
settings.beginGroup("Units");
GET_UNIT(v, "feet", length, units::METERS, units::FEET);