PDA

View Full Version : How to set outer border for QWidget so that it's inner widgets are unaffected?



Violet Giraffe
25th October 2011, 07:51
Greetings!

I have quite a strange problem. I have a QWidget with QHBoxLayout on it. The layout contains two QLabels.
I want to set a border for this whole widget. I'm using style sheet:
"padding: 10px;"
"border-style: solid;"
"border-width: 3px;"
"border-radius: 7px;"
"min-width: %1px;"
"max-width: %2px;"

But here's the problem: this style is applied to both QLabels and completely breaks the layout. I only need the outer window to have the border, not the labels.
Any ideas?

Thanks in advance!

sedi
26th April 2012, 18:15
Hi,

the stylesheet is valid for the children by "default".

You might want to read about selector types here:
http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html
or else (if you don't find what you need there) here:
http://www.w3.org/TR/CSS2/selector.html#q1