From 87decaa798f028f8d534b399240b8b0611503da4 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 4 Jun 2013 21:56:20 +0900 Subject: 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 --- qt-ui/divelistview.cpp | 17 +++++++++++------ 1 file 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 #include #include @@ -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); + } } } -- cgit v1.2.3-70-g09d2