tags:

views:

58

answers:

1

I am using QT 4.3. I have created one custom widget plugin. I could be able to show it in the desiner tool box as well as use it on the form with no problem.

This custom widget internally holds QGroupBox, QLabel, QTextEdit.

Now I want to apply the styles to individual componets of this custom widget. I want to expose these internal conrols as sub-control and style them. This would be similar to tear subcontrol of QTabWidget. In style sheet we can refer it as QTabWidget::tear...

Is there any way by which I can do similar thing with my custom widget?

A: 

The subcontrols are defined in the (internal to Qt) knownPseudoElements array in qstylesheetstyle.cpp, so you won't be able to add your own pseudoelements. However, you can use the ID Selector feature to address individual controls in your widget. For example, if the names of your QGroupBox, QLabel, and QTextEdit are group, label, and edit, you can use:

#group {color:green} #label {color:blue} #edit {background-color:red}

to change the sub-widgets

David Walthall