summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-14 08:18:26 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-14 08:18:26 -0300
commitb0374047dd6a31d8b16c6991ee0ffc51c198569e (patch)
treecf950820fc57fdeaac6ae81f43b80b62a73e4054 /qt-ui/divelistview.cpp
parent5868b37e6bde1eaa6da09aac5e269557d94d7641 (diff)
downloadsubsurface-b0374047dd6a31d8b16c6991ee0ffc51c198569e.tar.gz
code to show profile again
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index d192d84aa..d2354d910 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -55,6 +55,24 @@ void DiveListView::keyReleaseEvent(QKeyEvent* event)
QWidget::keyReleaseEvent(event);
}
+void DiveListView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
+{
+ if (!current.isValid())
+ return;
+ const QAbstractItemModel *model = current.model();
+ int selectedDive = 0;
+ struct dive *dive = (struct dive*) model->data(current, TreeItemDT::DIVE_ROLE).value<void*>();
+ if (!dive) { // it's a trip! select first child.
+ dive = (struct dive*) model->data(current.child(0,0), TreeItemDT::DIVE_ROLE).value<void*>();
+ selectedDive = get_divenr(dive);
+ }else{
+ selectedDive = get_divenr(dive);
+ }
+ if (selectedDive == selected_dive)
+ return;
+ Q_EMIT currentDiveChanged(selectedDive);
+}
+
void DiveListView::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
{
QList<QModelIndex> parents;