PDA

View Full Version : How to prevent style sheet propagating



ahmdsd_ostora
18th June 2010, 13:17
Hi,
When I set a style sheet to a parent widget, it is set to all its children widgets. I want to prevent this behavior.
I tried to set autoFillBackground to false, but no luck.

just I want a method to set an image behind child widgets, any solution or even a different method?

rajeevpodar
18th June 2010, 14:36
Hi you can try to check it's direct parent.
For example:

QGroupBox > QPushButton {
background-color: rgb(255, 255, 127);
}

In this Only Push button with GroupBox as parents will be of different color.

So prehaps you can try whose parent is qApp or Null.


Thanks
Rajiv

MorrisLiang
18th June 2010, 14:59
You can also set the widget's stylesheet by their name.
This will set the QPushButton whose name is "MyPushButton"
#MyPushButton{
...
}

ahmdsd_ostora
18th June 2010, 15:14
Yes I got it, and with the documentation help i will do it

Thank u guys.