Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.6.2, 5.7.0
-
Mac OS X, Windows
Description
This is most noticeable on a Mac laptop with trackpad, but it's also wrong with a regular scroll wheel mouse, just not so obvious.
Build and run the attached test app. This creates three different types of menus, each with lots of items to ensure that they require scrolling; a menu from a menu bar, a menu attached to a QPushButton and a QComboBox.
Open the QComboBox and flick downwards to scroll with the trackpad or mouse wheel. Observe that the scroll is quick, and behaves as you would expect.
Now click on the push button and do the same action. The scroll is slow and feels weird.
On Windows, the same scroll behaviour happens with the menu from the menu bar too. On Mac it doesn't, because it's an entirely native menu on that platform.
The reason for this seems to be that the QMenu used by the QPushButton doesn't have any scrollbar associated with it; it uses a simple scroller class, and handles wheel events in a very simple way. QMenuPrivate::scrollMenu is called with 'up' or 'down' depending on whether the wheel delta was positive or negative. This moves the menu up or down one item, taking no account of the scroll delta in the event. QComboBox, on the other hand, implements its menu with an item view, not actually using a QMenu at all. This item view always has an associated vertical scrollbar, which is hidden, and this scrollbar listens to wheel events and calls QAbstractSlider::scrollByDelta to do the right thing. This takes the proper delta into account.
Attachments
Issue Links
- relates to
-
QTBUG-60192 QScroller is too fast on widgets with scrollMode QAbstractItemView::ScrollPerItem
- Reported