summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2015-05-10 16:01:58 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-11 07:33:31 -0700
commit3edec7c97dac71f288d65fd0e86fc14c69649d9d (patch)
tree10723d3565341e2700c6045889e6d0fdc10d3f2c /qt-ui/divelistview.cpp
parent9523132b6da30231b3c56f3ee203a97b8a69c34f (diff)
downloadsubsurface-3edec7c97dac71f288d65fd0e86fc14c69649d9d.tar.gz
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp2
1 files changed, 2 insertions, 0 deletions
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 &current, const QModelIndex &previous)
{
+ if (!isVisible())
+ return;
if (!current.isValid())
return;
scrollTo(current);