diff options
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); + } } } |