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

QPushButton fails to handle QStyle::SH_DialogButtonBox_ButtonsHaveIcons correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.5.1
    • None
    • KUbuntu 14.04.3 and OS X 10.9.5 with KDE4 4.14.14 and KF5 5.16.0 installed in /opt/local
    • macOS

      Qt5 has never respected the QStyle::SH_DialogButtonBox_ButtonsHaveIcons setting correctly in all conditions, in my experience, at least not for QPushButtons:

      • on Linux, they always seem to show icons, even on a KDE deskop configured NOT to show them.
      • on OS X, they will not show icons as expected, at least not when using the Cocoa platform theme. Enable the KDE platform theme from KF5-frameworkintegration, and they will show icons even if the KF5 settings tell otherwise.

      I can see at least 1 bug in qpushbutton.cpp: QPushButton::sizeHint() should check for `(!icon().isNull() && showButtonBoxIcons)` instead of `(!icon().isNull() || showButtonBoxIcons)`.

      This is not enough, however, as shown by the screenshot I'll be attaching.
      It was made on a KDE4 desktop with Qt 5.5.1 and KF5 installed in /opt/local; KF5-frameworkintegration was deactivated so as to be sure that it is not the source of this bug.
      The test application is kdebugdialog5, which depends on kf5-kdelibs4support ; it is possible that this framework is involved through its KPushButton class.
      I added a qDebug statement to QPushButton::sizeHint; using the Fusion style it shows that the style indeed hints that no icons should be shown on buttons.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            rjvbertin René Bertin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes