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

FocusRing not shown on QPushButton with styled border

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.6, 6.2
    • Widgets: Styles
    • None
    • macOS

    Description

      When using a QPushButton having a customized border (stylesheet contains “border: 1 px solid #a8a8a8”), we need to set the attribute Qt::WA_MacShowFocusRect in order to show the focusRing.
      This worked in Qt 5.6.0, but after upgrading to Qt 5.12.6 this no longer works. (minimal example in attachment)

      This is because QMacStylePrivate::drawFocusRing is drawing the focusRing outside the bounds of the QPixmap used by the QPainter in this function. (This drawing code was introduced by https://code.qt.io/cgit/qt/qtbase.git/commit/src/plugins/styles/mac/qmacstyle_mac.mm?h=5.11&id=4b9e6b65c9036085b99ab9ef97c8136fb684ee89)

      Attachments

        1. SquareButton.zip
          3 kB
        2. QFocusTest.zip
          6 kB

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              dbutijn David Butijn
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes