PDA

View Full Version : Groupbox has no borders ?



vieraci
30th April 2009, 06:11
Hi All,

Qt 4.5
In Designer, In the StyleSheet dialog, I add a border color

border-color: rgb(0, 0, 0);
and nothing ! zilch ! no border shows.
What am I missing ?

Lykurg
30th April 2009, 07:51
You also have to set the width:
border: 1px solid #000;

e8johan
30th April 2009, 07:54
Have you looked at the QGroupBox example in the style sheets documentation: http://doc.trolltech.com/4.5/stylesheet-examples.html#customizing-qgroupbox ? They do it in a slightly different way.

vieraci
30th April 2009, 10:51
Thanks, got a border but the results aren't acceptable at all. (Image attached)

e8johan
30th April 2009, 10:54
You can prefix your border setting with QGroupBox, that would remove the borders arounds the inner widgets.

vieraci
30th April 2009, 11:19
You can prefix your border setting with QGroupBox, that would remove the borders arounds the inner widgets.

How do you 'prefix' ?

e8johan
30th April 2009, 11:22
You do something like this:


QGroupBox: { border: ...; }

vieraci
30th April 2009, 11:29
QGroupBox: { border: 2px solid gray; }

I'm back to no border with this code :o

e8johan
30th April 2009, 11:41
Ah, sorry, drop the colon


QGroupBox { ... }

vieraci
30th April 2009, 11:54
Yes !
now why is the break at the top left corner along the left side ?
Isn't the break normally along the top and the text in between the break ? like this:

+- groupbox heading ----------+
| |
| |
| |
+------------------------------------+

e8johan
30th April 2009, 11:56
I get the text on the top... when using Qt 4.5.0.

vieraci
30th April 2009, 12:37
Does it look like this attached image ? that's what I get QT 4.5 and QT Creator. ( btw: nice IDE ! )

Oops, sorry, I should have taken a look at the example you pointed me to in the first place. :o don't understand the code, but it got me a good result and the heading is on the line.

I did make one change,

subcontrol-position: top center;
to
subcontrol-position: top left;

and found the top left corner doesn't get drawn, and doesn't look right. For now, I'll settle for centred heading and read into the Style sheet usage further.

Thanks for your help.

e8johan
30th April 2009, 12:46
I only changed the border, that kept the text in place.