Bug 256042 - Dolphin automatically goes to top when hovering icon (Icons View, Previews and Grouping enabled)
Summary: Dolphin automatically goes to top when hovering icon (Icons View, Previews an...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords: investigated, reproducible
: 245062 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-04 12:32 UTC by Michiel de Bruijne
Modified: 2011-01-10 21:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.5.5


Attachments
Video demonstrating the problem (690.67 KB, video/ogg)
2010-11-04 12:32 UTC, Michiel de Bruijne
Details
dolphinrc (1.87 KB, text/plain)
2010-11-04 12:34 UTC, Michiel de Bruijne
Details
debugging patch (1.43 KB, patch)
2010-12-08 13:41 UTC, Frank Reininghaus
Details
Possible fix (614 bytes, patch)
2010-12-08 14:22 UTC, Frank Reininghaus
Details
Patch (1.07 KB, patch)
2010-12-10 12:33 UTC, Rafael Fernández López
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michiel de Bruijne 2010-11-04 12:32:58 UTC
Created attachment 53123 [details]
Video demonstrating the problem

Version:           unspecified (using KDE 4.5.2) 
OS:                Linux

This happens on Dolphin Version 1.5 Using KDE Development Platform 4.5.3 (KDE 4.5.3). This version isn't known in the KDE Bug Tracking System yet so I needed to select version 4.5.2.

Dolphin automatically goes to top when hovering icon. I will attach a video to demonstrate what happens. I will also attach dolphinrc.

Reproducible: Always

Steps to Reproduce:
This is reproducible on all systems with KDE 4.5.x (up to 4.5.3).

- Create files and/or folders in a folder so all contents don't fit on the screen.
- Scroll down
- Hover over a icon and notice that Dolphin automatically goes to the top.

Actual Results:  
Dolphin automatically goes to top when hovering icon.
With a lot of files/folder in a folder it is almost impossible to open a file or folder, because Dolphin constantly goes to the top.

Expected Results:  
Dolphin stays at the icon when hovering the icon
Comment 1 Michiel de Bruijne 2010-11-04 12:34:30 UTC
Created attachment 53124 [details]
dolphinrc
Comment 2 Michiel de Bruijne 2010-11-04 12:37:53 UTC
If you need more information then please let me know.
Comment 3 Frank Reininghaus 2010-11-04 13:48:46 UTC
Thanks for the bug report! I could reproduce this in trunk (in Icons View with previews and grouping) a couple of times, but now I can't reproduce the bug any more. Strange...

In any case, this is probably bug 245062.
Comment 4 Michiel de Bruijne 2010-12-07 18:14:58 UTC
(In reply to comment #3)
> Thanks for the bug report! I could reproduce this in trunk (in Icons View with
> previews and grouping) a couple of times, but now I can't reproduce the bug any
> more. Strange...
> 

Hi Frank (and Peter),

For me the problem is also reproducible in KDE 4.5.4. Are you able to reproduce it again? If not, is there something I can do to help you reproduce it? It would be fantastic if this can be resolved before KDE 4.6.

Thanks!
Comment 5 Frank Reininghaus 2010-12-08 13:41:17 UTC
Created attachment 54296 [details]
debugging patch

I've added a slot for debugging and set a gdb break point in DolphinIconsView::verticalScrollbarValueChangedToZero().

I'm getting the backtrace below when the view scrolls to top unexpectedly. It looks like QCommonListViewBase::updateVerticalScrollBar() decides to set the scrollbar range to zero for some reason.

Breakpoint 1, DolphinIconsView::verticalScrollbarValueChangedToZero (this=0xac02c0) at /home/kde-devel/kde/src/KDE/kdebase/apps/dolphin/src/views/dolphiniconsview.h:79
79              kDebug() << "*** Scrollbar value has been set to zero!!!";
(gdb) bt
#0  DolphinIconsView::verticalScrollbarValueChangedToZero (this=0xac02c0) at /home/kde-devel/kde/src/KDE/kdebase/apps/dolphin/src/views/dolphiniconsview.h:79
#1  0x00007ffff7693069 in DolphinIconsView::verticalScrollbarValueChanged (this=0xac02c0, value=0)
    at /home/kde-devel/kde/src/KDE/kdebase/apps/dolphin/src/views/dolphiniconsview.h:74
#2  0x00007ffff5043b9b in QAbstractItemView::qt_metacall (this=0xac02c0, _c=QMetaObject::InvokeMetaMethod, _id=26, _a=0x7fffffffc300)
    at .moc/debug-shared/moc_qabstractitemview.cpp:244
#3  0x00007ffff51f968b in QListView::qt_metacall (this=0xac02c0, _c=QMetaObject::InvokeMetaMethod, _id=57, _a=0x7fffffffc300) at .moc/debug-shared/moc_qlistview.cpp:111
#4  0x00007ffff598f1a3 in KCategorizedView::qt_metacall (this=0xac02c0, _c=QMetaObject::InvokeMetaMethod, _id=57, _a=0x7fffffffc300)
    at /home/kde-devel/kde/build/KDE/kdelibs/kdeui/kcategorizedview.moc:82
#5  0x00007ffff7692ae5 in DolphinIconsView::qt_metacall (this=0xac02c0, _c=QMetaObject::InvokeMetaMethod, _id=57, _a=0x7fffffffc300)
    at /home/kde-devel/kde/build/KDE/kdebase/apps/dolphin/src/dolphiniconsview.moc:84
#6  0x00007ffff3c13bfb in QMetaObject::metacall (object=0xac02c0, cl=QMetaObject::InvokeMetaMethod, idx=57, argv=0x7fffffffc300) at kernel/qmetaobject.cpp:237
#7  0x00007ffff3c28a8b in QMetaObject::activate (sender=0xa9c0a0, m=0x7ffff5717540, local_signal_index=0, argv=0x7fffffffc300) at kernel/qobject.cpp:3278
#8  0x00007ffff51f16b4 in QAbstractSlider::valueChanged (this=0xa9c0a0, _t1=0) at .moc/debug-shared/moc_qabstractslider.cpp:182
#9  0x00007ffff4e80fca in QAbstractSlider::setValue (this=0xa9c0a0, value=0) at widgets/qabstractslider.cpp:543
#10 0x00007ffff4e80780 in QAbstractSlider::setRange (this=0xa9c0a0, min=0, max=-112) at widgets/qabstractslider.cpp:252
#11 0x00007ffff505f038 in QCommonListViewBase::updateVerticalScrollBar (this=0x7d6e30, step=...) at itemviews/qlistview.cpp:1863
#12 0x00007ffff505d557 in QListView::updateGeometries (this=0xac02c0) at itemviews/qlistview.cpp:1492
#13 0x00007ffff598e4ea in KCategorizedView::updateGeometries (this=0xac02c0) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/itemviews/kcategorizedview.cpp:1331
#14 0x00007ffff5036195 in QAbstractItemView::doItemsLayout (this=0xac02c0) at itemviews/qabstractitemview.cpp:1139
#15 0x00007ffff505d35c in QListView::doItemsLayout (this=0xac02c0) at itemviews/qlistview.cpp:1474
#16 0x00007ffff503b8f6 in QAbstractItemView::timerEvent (this=0xac02c0, event=0x7fffffffd4f0) at itemviews/qabstractitemview.cpp:2417
#17 0x00007ffff50598e9 in QListView::timerEvent (this=0xac02c0, e=0x7fffffffd4f0) at itemviews/qlistview.cpp:817
#18 0x00007ffff3c242b7 in QObject::event (this=0xac02c0, e=0x7fffffffd4f0) at kernel/qobject.cpp:1181
#19 0x00007ffff4a25c19 in QWidget::event (this=0xac02c0, event=0x7fffffffd4f0) at kernel/qwidget.cpp:8714
#20 0x00007ffff4ed975f in QFrame::event (this=0xac02c0, e=0x7fffffffd4f0) at widgets/qframe.cpp:557
#21 0x00007ffff4f83b39 in QAbstractScrollArea::event (this=0xac02c0, e=0x7fffffffd4f0) at widgets/qabstractscrollarea.cpp:996
#22 0x00007ffff5036c78 in QAbstractItemView::event (this=0xac02c0, event=0x7fffffffd4f0) at itemviews/qabstractitemview.cpp:1555
#23 0x00007ffff505da5b in QListView::event (this=0xac02c0, e=0x7fffffffd4f0) at itemviews/qlistview.cpp:1632
#24 0x00007ffff49bdbca in QApplicationPrivate::notify_helper (this=0x635120, receiver=0xac02c0, e=0x7fffffffd4f0) at kernel/qapplication.cpp:4462
#25 0x00007ffff49bd8ca in QApplication::notify (this=0x7fffffffd8d0, receiver=0xac02c0, e=0x7fffffffd4f0) at kernel/qapplication.cpp:4427
#26 0x00007ffff59b9271 in KApplication::notify (this=0x7fffffffd8d0, receiver=0xac02c0, event=0x7fffffffd4f0)
    at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311
#27 0x00007ffff3c0ba87 in QCoreApplication::notifyInternal (this=0x7fffffffd8d0, receiver=0xac02c0, event=0x7fffffffd4f0) at kernel/qcoreapplication.cpp:731
#28 0x00007ffff49ae653 in QCoreApplication::sendEvent (receiver=0xac02c0, event=0x7fffffffd4f0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#29 0x00007ffff3c47e83 in QTimerInfoList::activateTimers (this=0x63ae90) at kernel/qeventdispatcher_unix.cpp:603
#30 0x00007ffff3c440e2 in timerSourceDispatch (source=0x63ae30) at kernel/qeventdispatcher_glib.cpp:184
#31 0x00007fffeede2a93 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#32 0x00007fffeede3270 in ?? () from /usr/lib64/libglib-2.0.so.0
#33 0x00007fffeede3510 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#34 0x00007ffff3c44baf in QEventDispatcherGlib::processEvents (this=0x60cf40, flags=...) at kernel/qeventdispatcher_glib.cpp:422
#35 0x00007ffff4a96692 in QGuiEventDispatcherGlib::processEvents (this=0x60cf40, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#36 0x00007ffff3c095ea in QEventLoop::processEvents (this=0x7fffffffd840, flags=...) at kernel/qeventloop.cpp:149
#37 0x00007ffff3c0973e in QEventLoop::exec (this=0x7fffffffd840, flags=...) at kernel/qeventloop.cpp:201
#38 0x00007ffff3c0c17a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#39 0x00007ffff49bad66 in QApplication::exec () at kernel/qapplication.cpp:3736
#40 0x00007ffff7b8bb59 in kdemain (argc=2, argv=0x7fffffffde08) at /home/kde-devel/kde/src/KDE/kdebase/apps/dolphin/src/main.cpp:98
#41 0x0000000000400956 in main (argc=2, argv=0x7fffffffde08) at /home/kde-devel/kde/build/KDE/kdebase/apps/dolphin/src/dolphin_dummy.cpp:3
Comment 6 Frank Reininghaus 2010-12-08 13:41:47 UTC
I'll add Rafael (author of KCategorizedView) to CC, maybe he has an idea.
Comment 7 Frank Reininghaus 2010-12-08 14:18:11 UTC
QCommonListViewBase::updateVerticalScrollBar(const QSize &step) contains the line

verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height());

Adding some debug output shows me that contentsSize.height() is smaller than viewport()->height() in the problematic situation, and that sets the range to zero.
Comment 8 Frank Reininghaus 2010-12-08 14:22:21 UTC
Created attachment 54298 [details]
Possible fix

I've noticed that KCategorizedView::updateGeometries() contains some code to restore the vertical scroll bar position, but only in ScrollPerPixel mode. My patch also does that in ScrollPerItem mode.

I'm just not sure if this is really the right way to fix it or if it is actually only a workaround for the real bug.

Rafael, Peter: any ideas?
Comment 9 Frank Reininghaus 2010-12-08 14:25:05 UTC
*** Bug 245062 has been marked as a duplicate of this bug. ***
Comment 10 Peter Penz 2010-12-09 16:47:47 UTC
@Frank: Thanks for investigating into this. I'm not very familiar with the KCategorizedView code and I'm unsure too whether this fix might just hide the real bug. But as the same fix has been applied already in the ScrollPerPixel mode and seems to be only KCategorizedView-related, I'd say it is save to commit. But I'd suggest to wait a few days to give Rafael a chance for feedback :-)
Comment 11 Rafael Fernández López 2010-12-10 11:42:42 UTC
Can't reproduce this on trunk, so it seems the last change we did fixed this problem too.

Checkouting 4.5 branch to try to reproduce.
Comment 12 Rafael Fernández López 2010-12-10 12:33:51 UTC
Created attachment 54385 [details]
Patch

Okay, now I got how to reproduce it even on trunk. My way to reproduce is slightly different, but I am confident is essentially the same bug.

It is a good idea to order by name in the categorized view, so we can easily reproduce.

1. Go to a folder that needs the vertical scrollbar to be shown in order to show all elements. Contents might be 4 folders: "a", "b", "c" and "d".

2. Scroll the view to the bottom.

3. Create folder "e".

4. The view is automatically (and wrongly) moved to the top (or pseudo-top).

Thanks for the great analysis and time taken to catch this bug.

Now that I could reproduce, I must say that the patch can be improved for the sake of code readability. My proposal is the attached one.

Frank, since you have the merit feel free to commit the patch I propose. If you haven't got an SVN account just tell me and I'll commit it.
Comment 13 Frank Reininghaus 2010-12-10 14:27:16 UTC
SVN commit 1205215 by freininghaus:

In KCategorizedView::updateGeometries(), restore the vertical offset
not only in ScrollPerPixel, but also in ScrollPerItem mode. Fixes the
problem that Dolphin's Icons view may scroll to the top unexpectedly.

CCBUG: 256042


 M  +2 -3      kcategorizedview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1205215
Comment 14 Frank Reininghaus 2010-12-10 14:27:57 UTC
SVN commit 1205217 by freininghaus:

In KCategorizedView::updateGeometries(), restore the vertical offset
not only in ScrollPerPixel, but also in ScrollPerItem mode. Fixes the
problem that Dolphin's Icons view may scroll to the top unexpectedly.

BUG: 256042
FIXED-IN: 4.5.5


 M  +2 -3      kcategorizedview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1205217
Comment 15 Michiel de Bruijne 2010-12-10 14:32:16 UTC
Hi guys,

Many, many thanks for your time, effort and support to solve this bug! It is really appreciated!
Comment 16 Frank Reininghaus 2010-12-10 14:36:01 UTC
Thanks Rafael, somehow I had overlooked that the code could be simplified that easily ;-)

If you agree, I might write a unit test for that bug when I find some time and put it into a new file kcategorizedview_unittest.cpp. I think automatic testing can be a very effective tool to prevent regressions in the future. What do you think?

Another remark: Hovering icons does not make the view scroll to the top any more, but I've noticed that the tool tips sometimes disappear after a very short while. This may be a related issue.

(In reply to comment #15)
> Hi guys,
> 
> Many, many thanks for your time, effort and support to solve this bug! It is
> really appreciated!

You're welcome :-)
Comment 17 Michiel de Bruijne 2011-01-10 21:17:01 UTC
Hi guys,

I have tested Dolphin version 1.5 using KDE Development Platform 4.5.5 and would like to confirm that this bug has been resolved.

Again many thanks!