PDA

View Full Version : using style in QGroupBox..



sudhansu
29th April 2010, 14:43
Hi All
I've a groupbox.
I've applied style like


QPlastiqueStyle * WindowsStyle = new QPlastiqueStyle;
groupBox->setStyle(WindowsStyle);

Now i want to make the border 1px of black color.
How to do it. I've attached the sample code please tell me how to fix.

tbscope
29th April 2010, 17:51
Don't use a style like this. You would need to subclass a style.

Much easier is to use a CSS style for your control, like this:

groupBox->setStyleSheet("border-color = black");

http://doc.trolltech.com/4.2/stylesheet.html#border-attr
http://doc.qt.nokia.com/4.6/stylesheet-syntax.html

sudhansu
30th April 2010, 06:05
Don't use a style like this. You would need to subclass a style.

Much easier is to use a CSS style for your control, like this:

groupBox->setStyleSheet("border-color = black");

http://doc.trolltech.com/4.2/stylesheet.html#border-attr
http://doc.qt.nokia.com/4.6/stylesheet-syntax.html


Hi tbscope,
Thank you for reply. But if you apply stylesheet then groupbox test will be displayed (alligned) below the border. I've attached the code. can u plz verify it.
NB : I ve commented apply apply stylesheet in code.

tbscope
30th April 2010, 06:51
Check out this example:
http://doc.qt.nokia.com/4.6/stylesheet-examples.html#customizing-qgroupbox