summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-02 17:01:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-02 17:02:55 -0700
commitff2ce399702d3a487316bfcc4b1fff01dbb8d309 (patch)
tree709b497e1981873b5301c68c0a906b874b7dd635 /qt-ui/mainwindow.cpp
parent021ef8ad09295a0ad4b5a3450a651637eea8672d (diff)
parent696c9ccacd24392ea63477c5ec8a25d6649aedf7 (diff)
downloadsubsurface-ff2ce399702d3a487316bfcc4b1fff01dbb8d309.tar.gz
Merge branch 'tomaz-css' into Qt
Tomaz' code does a much better job of shading the dive list! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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 8bf03531f..cdd33ff45 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -25,6 +25,7 @@
#include "../divelist.h"
#include "../pref.h"
#include "modeldelegates.h"
+#include "models.h"
MainWindow::MainWindow() : ui(new Ui::MainWindow()),
model(new DiveTripModel(this)),
@@ -33,6 +34,7 @@ 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)));
/* figure out appropriate widths for the columns. The strings chosen
* are somewhat random (but at least we're trying to allow them to be
@@ -70,6 +72,16 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
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");