Applying a certain stylesheet at the mainwindow, will also be applied to any QWidget in that window
-
So i had set the mainwindows stylesheet as:
@border-image: url(:/icons/Pictures/Background.png) 4 4 4 4 stretch stretch;@!http://i.imgur.com/9zoCxwE.png(1)!
In the above screenshot u can see
2 spacers
a Qwidget
inside of the Qwidget a labelThe qwidget has stylesheet
@QWidget {\nbackground-color: black;\n}@but u can see that the background is not black... why is that?
-
Hi,
style sheets are always also valid for derived classes.
But you have moire options for the selector, so if your main windows class has a special name (or a special class) use that as selector and it does what you want. Have a look at the style sheet documentation. -
Not only for derived classes, but especially for child objects. That's why they are called cascading: any style you set on a parent object, will propagate down towards child widgets too. There is no way to stop that from happening, other than to use a more specific selector for the parent style so that it does not apply to the child widgets you don't want it to apply for.