If I apply stylesheets to qApp or any QWidget that is parent of a QMessageBox (or QMessageBox directly), it looses the native look and feel on Mac (not sure other OSs because I haven't try with them).
I tested this with the example from Qt called "standarddialogs", and modified the code at QDialog::criticalMessage()
Here is the QMessageBox without stylesheets:
Qt Code:
void Dialog::criticalMessage() { box.setWindowTitle( title ); box.setText( "Question question question???????" ); //box.setStyleSheet("QPushButton { color: red }"); box.setInformativeText( "sdkhfgkdfhgkdh" ); int buttonClicked = box.exec(); }To copy to clipboard, switch view to plain text mode
QMessageBox no sylesheet.png
Here it is when un-commenting the setStyleSheet line from the code above:
QMessageBox with sylesheets on QPushButton.png
As you can see, even if the stylesheet is not affecting QLabel, QMessageBox looses the bold question text and the description text's size is increased.
Is there a way to use stylesheets without loosing the Mac OS look and feel for QMessageBox?
Bookmarks