diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-02 20:32:57 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-02 16:56:48 -0700 |
commit | 696c9ccacd24392ea63477c5ec8a25d6649aedf7 (patch) | |
tree | 372fdebe1a83f3fd5d10cd1cff94ee32ed835f31 /qt-ui/mainwindow.cpp | |
parent | 82b1b04920fdd5882e0cbf28c9871c2ddd404af8 (diff) | |
download | subsurface-696c9ccacd24392ea63477c5ec8a25d6649aedf7.tar.gz |
Added code to Select a dive, fixed minor annoyances.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 12 |
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"); |