From 3edec7c97dac71f288d65fd0e86fc14c69649d9d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 10 May 2015 16:01:58 -0700 Subject: Fix initial scrolling problem The initial selection change signal seems to potentially be sent before the listview is even visible when we do the first "scrollTo()" to the currently selected dive. That, in turn, seems to result in that when the listview is actually shown, it will be scroll the trip description off the visible area, and force the current dive to be shown at the very top of the divelist. Which is not very nice: we do want to scroll to the current dive, but we don't want to hide the current trip in the process. Ignoring the selection change if the listview isn't even visible seems to fix things for me. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 0b79ef9fc..3c63bea50 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -514,6 +514,8 @@ void DiveListView::toggleColumnVisibilityByIndex() void DiveListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { + if (!isVisible()) + return; if (!current.isValid()) return; scrollTo(current); -- cgit v1.2.3-70-g09d2