PDA

View Full Version : QFrame and stylesheet



bwnicewo
11th May 2012, 16:12
The main application of my project defines a QFrame item in a stylesheet like this:

QFrame
{
padding: 0px;
margin: 0px;
border-style:none;
}

I want to overwrite this for a particular class so a line will show up, I tried using:

MyClass QFrame {}

...but no luck. I've wrestled with stylesheet issues before and this bugs me to the nth degree cause everything that should work hasn't worked.

Spitfire
17th May 2012, 11:48
Try
MyClass {}

tferreira
17th May 2012, 12:34
If your class inherits QFrame, just set an object name in your class constructor for example. Something like this:

setObjectName("myClassFrame");

and then, in your stylesheet, do something like this:

QFrame#myClassFrame {
/*your qss properties here*/
}

bwnicewo
17th May 2012, 20:30
I found a workaround, thanks.