[Qt-interest] [Stylesheets] Reverting all settings for some classes.

Oliver Demetz forenbeitraege at oliverdemetz.de
Mon Jul 20 11:25:05 CEST 2009


Hi!

I have changed the look of the buttons of my app:

QPushButton {
/* style options */
}

QPushButton:hover {
/* style options */
}

..and so on.

Since these adoptions look ugly in connection with message boxes,
I would now like not to apply all these options to eg. MessageBoxes.
So what I did is just select children of my parent widgets:

CustomerListWidget > QPushButton, CustomerDetailDialog > QPushButton{
...
}

But since I am using nested Layouts, only selecting direct children does 
not work, so I need the general descendant selector:

CustomerListWidget QPushButton, CustomerDetailDialog QPushButton{
...
}

which selects all descentdants of CustomerListWidget and 
CustomerDetailDialog.

But now all my QMessageBoxes are eg. parented to these widgets.
As example, I have lots of calls to warning messageboxes in 
CustomerListWidget like:

QMessageBox::warning( _this_ ,tr("bla"));

Where _this_ is a poitner to the CustomerListWidget. Thus, the Buttons 
in this warning are styles, and I dont want that.

Can I disable all style options for this case?

Thanks for your help in advance,
best regards,
Oliver



More information about the Qt-interest-old mailing list