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

[REG 5.12.3->6.2.1] Horizontal part of subcontrol-position of menu-indicator is ignored

XMLWordPrintable

    • Linux/X11, macOS, Windows
    • 1c338e6d07 (qt/qtbase/dev) 1c338e6d07 (qt/tqtc-qtbase/dev) 240a5e9d5b (qt/qtbase/6.3) 240a5e9d5b (qt/tqtc-qtbase/6.3) 9d41bd4312 (qt/qtbase/dev) 9d41bd4312 (qt/tqtc-qtbase/dev) 90e14f94c3 (qt/qtbase/6.3) 90e14f94c3 (qt/tqtc-qtbase/6.3)

      In Qt5, having subcontrol-position of QToolButton menu-indicator set to "right" works properly. In Qt6, the menu indicator arrows stays at the center.

      A workaround is to use  a background-image as the arrow and to control its position with background-position instead of relying on the menu-indicator.

      The attached sample code has two style sheets to try:

      • stylesheet1 uses the menu-indicator subcontrol-position (works with Qt5, bug with Qt6)
      • stylesheet2 uses the background-image/background-position/background-repeat (workaround that works with both Qt5 and Qt6)
        See "LINE TO EDIT" in the sample code to switch between the style sheets.

      The images attached show the 2 style sheets with either Qt 5.12.3 or
      Qt 6.2.1 on macOS Big Sur 11.6.5 with XCode 13.2.1.

      Note that the issue is not limited to macOS. It is also observed on Linux
      (CentOS 7.9.2009, MATE 1.16.2, g++ 9.3.0 in my case)

        1. main.cpp
          1.0 kB
          Thorbjørn Lund Martsum
        2. qt5.12.3-stylesheet1.png
          138 kB
          François Bertel
        3. qt5.12.3-stylesheet2.png
          137 kB
          François Bertel
        4. qt6.2.1-stylesheet1.png
          138 kB
          François Bertel
        5. qt6.2.1-stylesheet2.png
          138 kB
          François Bertel
        6. qtoolbutton-menu-indicator.tgz
          2 kB
          François Bertel
        7. screenshot-1.png
          6 kB
          Thorbjørn Lund Martsum
        8. screenshot-2.png
          4 kB
          Thorbjørn Lund Martsum
        9. screenshot-3.png
          4 kB
          Thorbjørn Lund Martsum
        10. ToolButtonDropDownIssue.pro
          0.3 kB
          Thorbjørn Lund Martsum
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            vhilshei Volker Hilsheimer
            fbertelschrodinger François Bertel
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: