PDA

View Full Version : Default stylesheet of QGroupBox



mstegehu
26th March 2010, 11:02
Hello,

I have a QGroupBox with two QComboBoxes and three QPushButtons.

If no selection is made in either one of the checkboxes I want the border of the groupbox to be red. So I used stylesheets.

But not knowing the default stylesheet of the QGroupBox I can not get it the same size / margins / padding.

Has anyone an idea how to get the correct stylesheet code?



m_groupBox->setStyleSheet(QString::fromUtf8("QGroupBox { border: 1px solid red; border-radius: 5px; margin-top: 7px; margin-bottom: 7px; padding: 0px} QGroupBox::title {top:-7 ex;left: 10px; subcontrol-origin: border}"));


Regards,

Marcel

kaima
12th November 2010, 09:31
I'm having the same question. How to get the default stylesheet of a widget? styleSheet() always returns empty string if was not set in application before.

I particularly have problem with styling QCheckbox. I tried to change size of the indicator of a checkbox by
my_checkbox->setStyleSheet("QCheckBox::indicator {width: 30px; height: 30px;}");

I compile my app with Qt 4.3. In PC the result is like expected. But when my same application runs with same lib compiled for ARM, only the rectagle box changes size, the indicator mark still remains its default size (when no setStyleSheet called) and stays at the top left corner of the box. Has anybody experienced with this?

My one hope is to get the default stylesheet of the checkbox, then see what to change in there ...

Help would be very much appreciated!

mstegehu
26th November 2010, 08:37
I contacted QT/Nokia en got an answer:

When the application is started normally it has no stylesheet; All elements are drawn by Windows/Mac etc and not by QT. By using stylesheets QT starts to paint the elements. I got an almost working red border of the groupbox that can switch back to normal but there is a small layout issue.

It would be very convenient if there was a simple application to create stylesheets for applications.

It would be more convenient if QT/Nokia would supply default stylesheets for whole applications. Thus for example the basic Windows 7 theme in a stylesheet.

wysota
26th November 2010, 08:44
It would be very convenient if there was a simple application to create stylesheets for applications.
Designer has stylesheet editing support.


It would be more convenient if QT/Nokia would supply default stylesheets for whole applications. Thus for example the basic Windows 7 theme in a stylesheet.
You can't emulate the exact look of native widgets without just substituting the background of a widget with an image so this is not possible, you are expecting too much.