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

QSS docs about QWidget and WA_StyledBackground are incomplete or inconsistent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.9, 6.7
    • Widgets: Style Sheets
    • None
    • All

    Description

      The behavior of QWidget subclassing in QSS and that of Qt::WA_StyledBackground have similar result, but may be misleading and change depending on the situation.

      First of all, Qt::WA_StyledBackground does not only style the background but also follows related rules, such as borders. The documentation does not mention that.

      Then, most importantly, a widget that has the above flag set, always draws the background and borders, even if the paint event is ignored, which is unexpected: installing an event filter on a widget and ignoring a QEvent:Paint (eg, by returning true) event, or overriding paintEvent() and then doing nothing in it, will still result in the widget being painted with the QSS rule, with border and background being shown.

      I may understand the reasoning behind all that, but the documentation should at least mention these aspects, both in the QSS reference and in the WidgetAttribute enum docs.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            musicamante Maurizio Berti
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes