![]() ![]() QApp->setStyle(QStyleFactory::create("Fusion")) ĭtColor(QPalette::Window, QColor(53,53,53)) ĭtColor(QPalette::WindowText, Qt::white) ĭtColor(QPalette::Base, QColor(25,25,25)) ĭtColor(QPalette::AlternateBase, QColor(53,53,53)) ĭtColor(QPalette::ToolTipBase, Qt::white) ĭtColor(QPalette::ToolTipText, Qt::white) ĭtColor(QPalette::Text, Qt::white) ĭtColor(QPalette::Button, QColor(53,53,53)) ĭtColor(QPalette::ButtonText, Qt::white) ĭtColor(QPalette::BrightText, Qt::red) ĭtColor(QPalette::Link, QColor(42, 130, 218)) ĭtColor(QPalette::Highlight, QColor(42, 130, 218)) ĭarkPalette. Feel free to make changes and submit them back on Github though! You can use this theme in all your applications, but be sure to tell me about them if you can. But I am happy to say that it now seems to work fine with Qt 5.12. Previously Qt support for dark themes was patchy. ![]() Alternatively, I’m posting the code below in a collapsed code box. Dark themes are now available for Windows 10 and Mac and it is increasingly expected that desktop applications will offer a dark theme. I’ll post that later as a quick tip/tutorial. I’m putting the code up on Github in a gist, but there won’t be the code to switch between the two themes. Luckily, the Fusion theme uses the applications color palette. I was working on an application recently where the people I was making it for wanted to be able to switch between a lighter and darker theme. My favorite new theme (for Windows applications, at least) is the Fusion theme that came with Qt 5.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |