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.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 9901e4186..ae2794e3c 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -23,6 +23,7 @@
#include "../divelist.h"
#include "../pref.h"
#include "modeldelegates.h"
+#include "models.h"
MainWindow::MainWindow() : ui(new Ui::MainWindow()),
model(new DiveTripModel(this)),
@@ -31,11 +32,22 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
ui->setupUi(this);
sortModel->setSourceModel(model);
ui->ListWidget->setModel(sortModel);
+ connect(ui->ListWidget, SIGNAL(activated(QModelIndex)), this, SLOT(diveSelected(QModelIndex)));
setWindowIcon(QIcon(":subsurface-icon"));
readSettings();
}
+void MainWindow::diveSelected(const QModelIndex& index)
+{
+ struct dive *dive = (struct dive*) index.model()->data(index, TreeItemDT::DIVE_ROLE).value<void*>();
+
+ if (dive)
+ selected_dive = get_index_for_dive(dive);
+
+ // Here should be the code to update the other widgets.
+}
+
void MainWindow::on_actionNew_triggered()
{
qDebug("actionNew");