Skip to content

Commit

Permalink
feat(ui): use Fusion style on Windows 10 & 11 (#1495)
Browse files Browse the repository at this point in the history
This enables dark mode support.

Fixes #811.
  • Loading branch information
trollixx committed Apr 30, 2023
1 parent b5ca9e7 commit a524735
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/main.cpp
Expand Up @@ -189,6 +189,16 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif

// Use Fusion style on Windows 10 & 11. This enables proper darl mode support.
// See https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5.
// TODO: Make style configurable, detect -style argument.
#if defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
const auto osName = QSysInfo::prettyProductName();
if (osName.startsWith("Windows 10") || osName.startsWith("Windows 11")) {
QApplication::setStyle("fusion");
}
#endif

QScopedPointer<QApplication> qapp(new QApplication(argc, argv));

const CommandLineParameters clParams = parseCommandLine(qapp->arguments());
Expand Down

0 comments on commit a524735

Please sign in to comment.