Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.15.6
-
None
Description
Normally, QListView with scroll mode set to QAbstractItemView::ScrollPerItem (which is the default) should set the single step size of its vertical scrollbar to such a value that scrolling with the mousewheel will scroll the items in the view in multiples of the item size. This works well in both view modes QListView::ListMode and QListView::IconMode.
However, when the view was previously in ListMode and then is switched to IconMode, this stops to work as the vertical scrollbar's singleStep will be set to 1 and will not be updated to any different value. Changing the view's gridSize or IconSize properties has no effect on the scrollbar anymore, it will just stay locked at this single step of 1. This is very inconvenient, as scrolling with the mousewheel will scroll the view's contents pixel by pixel, which is way to slow.
This is caused by QListModeViewBase::updateVerticalScrollBar(const QSize &step), which is used when the view is in list mode. It sets the scrollbar to a single step of one, thereby setting the flag QAbstractSliderPrivate::viewMayChangeSingleStep to false, which will later block any attempt from the view to set a different value.
The only way to enable single step updates by the view, is to call setSingleStep(-1) on the scrollbar, which will reset this flag and make updates working again.