Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56598

Popup menus (for example, a menu attached to a QPushButton) don't scroll at the correct speed when using the mouse wheel or track pad

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.6.2, 5.7.0
    • Fix Version/s: None
    • Component/s: GUI: Look'n'Feel
    • Environment:
      Mac OS X, Windows
    • Platform/s:
      macOS

      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

        1. menu-scroll-test.zip
          3 kB
        2. qtbug56598_diag.diff
          3 kB
        3. qtbug56598_log.txt
          108 kB
        4. qtbug56598.zip
          2 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              tpochep Timur Pocheptsov
              Reporter:
              jlarcombe James Larcombe
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes