[Solved] Dynamically set style.
I'm trying to dynamically set application style in a following way:
where styleName can be one of QStyleFactory::keys();
Every time above is executed look of the application changes but not correctly. To complete application must be restarted.
Is there a way how to avoid restarting?
OK, I found a solution.
Two methods have to be called in reverse order.
QStyle *style = QStyleFactory::create(styleName); QApplication::setPalette(style->standardPalette()); QApplication::setStyle(style);
And now it works as desired.