PDA

View Full Version : Hijack QWidget::setStyleSheet for a QObject class (non QWidget) ?



muenalan
29th October 2010, 22:39
I would like to set multiple properties for my QObjects with the versatile stylesheet syntax. The selecting of particular QObjects in my hierarchies would be essentially very helpfull. I dont want to make all these classes QWidgets (which would make no sense). Is there any way to use the mechanism ?

Sidenote: QDeclerativeContext in 4.6 seems to do a similar thing, but I would prefer to work on the bounds of 4.5.

Thx!

wysota
30th October 2010, 12:28
Style sheets are meant for widgets only. You can use QObject::findChildren() to find the objects you are interested in and then use QObject::setProperty() to manipulate their properties.