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

QLabel Style sheet (conditional on accessibleName) not applied When Placed in Grid Layout Inside QScrollArea

XMLWordPrintable

    • Windows

      Scenario

      • Style sheet with a general clause for QLabel and another clause for QLabel depending on accessibleName
      • When placing QLabel widgets inside a QGridLayout within a QScrollArea (accessibleName set accordingly) the clause depending on accessibleName does not take effect (it does work in very peculiar circumstances, like setting window flags on the top level or parenting)

      Steps to Reproduce

      1. Build and run the attached example project qtbug137551_2.zip.
      2. It shows the Form.ui (accessibleName setting) embedded into several top level using various methods. Note the clause for QLabel depending on accessibleName works only in a few cases.
      1. Compare with a similar QLabel placed outside the scroll area that does apply the style correctly.

      Actual

      All QLabel widgets, whether inside or outside a QScrollArea, should apply the stylesheet consistently.

      Expected

      Labels inside the scroll area do not reflect the applied style, unlike those outside.

      Workaround:

      The only way to force the style to apply inside the scroll area is to:

      • Not set a parent on the QLabel
      • Set the Qt::Window flag on the label

      This workaround is not ideal and breaks normal widget hierarchy and layout.

        1. QLabelIssue.rar
          74 kB
        2. QLabel style issue.png
          QLabel style issue.png
          78 kB
        3. qtbug137551_2.zip
          73 kB
        4. qtbug137551_log.txt
          1 kB
        5. qtbug137551.zip
          2 kB
        6. QTBUG-137551.zip
          19 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            chakib Chakib Boutaghane
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes