I have an issue with the management of Qt style sheets.
I have a big Qt application that can change its colors theme dynamically. To do that, I created several style sheets (one by theme - they are quite big). When a user wants to change the color theme, he clicks on a button that calls the QWidget
method setStylesheet(QString)
of the MainWindow
. This actually works but my GUI freezes 8-10 seconds in the process.
To reduce the delay, I've tried to use unpolish(QApplication * application)
and QStyle::polish(QApplication * application)
. The performance is quite impressive (less than one second) but several Widget
properties are not updated, e.g. the icon property of the QToolButton
. Moreover all my custom widgets are not updated even if they inherits from common widget classes (QFrame
, Qwidget
, QStackedWidget
etc...).
Do I miss something with the polish
method? Is there another way to perform a better update of the style of my application?