[RFC - tentartive PATCH] Fix initial scrolling problem

Linus Torvalds torvalds at linux-foundation.org
Sun May 10 16:01:58 PDT 2015


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 at linux-foundation.org>
---

This patch works for me, but the reason it has that "RFC - tentative"
is that I just don't know the Qt initial exposure rules. The way I
zoomed in on this was to just print debug messages for every
scrollTo(), and figuring out which one triggered, and noticing that
"isVisible()" isn't actually true for this case.

Put another way: I don't have any idea what I'm doing. I'm not a GUI
person. I also suspect that this whole behavior is timing-sensitive,
because it doesn't happen for me on smaller test-cases I've tried. So
I'd *really* like somebody like Tomaz or Thiago at least say "ok, that
isn't entirely insane".

Tomaz? Thiago?
-------------- next part --------------
 qt-ui/divelistview.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 93454dda0bf6..ed6bea8608c6 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);


More information about the subsurface mailing list