diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-04 21:56:20 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-04 21:56:20 +0900 |
commit | 87decaa798f028f8d534b399240b8b0611503da4 (patch) | |
tree | a0777684aa9c96d7baec8350e3f093d6645a2189 /qt-ui/divelistview.cpp | |
parent | ed0f558efb633e573cfec9af76ebd1604271492c (diff) | |
download | subsurface-87decaa798f028f8d534b399240b8b0611503da4.tar.gz |
Stop showing the first dive after a preferences change
What is missing is the code to actually show the RIGHT dive...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 5883ea615..1e822869b 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -7,6 +7,7 @@ #include "divelistview.h" #include "models.h" #include "modeldelegates.h" +#include "../display.h" #include <QApplication> #include <QHeaderView> #include <QDebug> @@ -136,12 +137,16 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort) return; sortByColumn(0, Qt::DescendingOrder); - QModelIndex firstDiveOrTrip = m->index(0,0); - if (firstDiveOrTrip.isValid()) { - if (m->index(0,0, firstDiveOrTrip).isValid()) - setCurrentIndex(m->index(0,0, firstDiveOrTrip)); - else - setCurrentIndex(firstDiveOrTrip); + if (amount_selected && selected_dive >= 0) { + // magic happens and the selected dive is expanded and scrolled to + } else { + QModelIndex firstDiveOrTrip = m->index(0,0); + if (firstDiveOrTrip.isValid()) { + if (m->index(0,0, firstDiveOrTrip).isValid()) + setCurrentIndex(m->index(0,0, firstDiveOrTrip)); + else + setCurrentIndex(firstDiveOrTrip); + } } } |