[SOLVED] Fusion style - how to set dark version?
-
Hi,
Referring to this article: http://blog.qt.digia.com/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/ you find dark version of fusion style. Is it compiled in QT by default? I don't know how to set it.
Regards
-
I assume Fusion honours Qt style sheets and/or QPalette to set the various colours.
-
I answered a similar question in the comments section you link to actually. It does respect QPalette, so you can try setting these color roles on the QApplication palette:
window/button: #353535
highlight: #8e2dc5 -
Thanks! Working perfect. But can't find color name for tabsheet text. I have this:
QApplication::setStyle(QStyleFactory::create("Fusion")); QPalette p; p = qApp->palette(); p.setColor(QPalette::Window, QColor(53,53,53)); p.setColor(QPalette::Button, QColor(53,53,53)); p.setColor(QPalette::Highlight, QColor(142,45,197)); p.setColor(QPalette::ButtonText, QColor(255,255,255)); qApp->setPalette(p);
All buttons have white font except tabsheet text where it is still black
edit: please wrap code sections between @ signs; Andre
-
I am not sure what you mean by tab sheet but you can also experiment with QPalette::WindowText and QPalette::Text roles. In some cases perhaps you also need to set a widget specific palette.
-
Problem solved. Override QPalette::WindowText was needed also. Thanks!
-
This technique works, but I wouldn't say the result is "perfect". The Fusion style generates lots of colors automatically by calling QColor::lighter() and QColor::darker(), and those would need to be inverted for the result to be perfect. As a result, depending on the exact colors you use, the frames around menus and the separators between menu items, for example, tend to disappear...