Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.9
Description
When placing QLabel widgets inside a QGridLayout within a QScrollArea, the applied stylesheet does not take effect. However, the same QLabel style works correctly when the label is placed outside the scroll area.
Steps to Reproduce:
- Build and run the attached example project.
- Observe that the QLabel widgets inside the QScrollArea do not apply the expected style (e.g., background color).
- Compare with a similar QLabel placed outside the scroll area that does apply the style correctly.
Expected Behavior:
All QLabel widgets, whether inside or outside a QScrollArea, should apply the stylesheet consistently.
Actual Behavior:
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.