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

Oliver Demetz forenbeitraege at oliverdemetz.de
Mon Jul 20 14:29:41 CEST 2009


Ender EREL schrieb:
> You could switch from static QMessageBoxes to dynamically created custom 
> ones, and reset the style sheet.
> 
> QMessageBox* box = new QMessageBox(this);
> /// Customization codes///
> box->setStyleSheet("");
> box->show();
> 
> But this will reset the stylesheets of other elements like labels etc. 
> in the message box.
> 
I tried this, and it works.
I wanted to avoid having to change all MessageBoxes.
For the sake of simplicity I now just changed their parent from this to 
NULL, which also does the job for me. If their parent is not the parent 
widget of the styled buttons anymore, the boxes buttons are "unstyled".

Thanks,
Oliver



More information about the Qt-interest-old mailing list