How to apply style sheet to nested properties?
-
If we want the property to apply only to one specific instance, we can specify the object name in the style sheet.
// the style sheet will only apply to the object called evilButton
QPushButton#evilButton { background-color: red }
What if I want the following property to also be used by a specific object? I noticed that if I wrote QScrollBar#evilScroller:vertical, the style isn't applied at all.
QScrollBar:vertical{ background:palette(base); border-top-right-radius:2px; border-bottom-right-radius:2px; width:16px; margin:0px; }
-
@Bonnie hahaha! Nope, sorry it's a bad example. I renamed it now. But I realize that the scrollers are automatically created by QGraphicScene and I've only set the window's objectName but not the scroller's object name. I don't know if I can actually set the scrollers' object names manually as QGraphicScene doesn't seem to have a function to access it's scrollers.
-
Hi
I assume you mean on QGraphicsView as QGraphicScene is nonvisual so I will be hugely surprised if it has scrollbars :)In any case, if i set on the view, its used when scrollbar shows up