From ff07a5e74e2671af068f20709847d027985e0097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Thu, 18 Apr 2024 19:56:22 +0200 Subject: [PATCH] Set proper window title bar color on Windows --- src/app/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 4f3dbdd79..f2b55e13b 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -86,6 +86,17 @@ void generateAlphaMesh(QPixmap& alphaMesh, int main(int argc, char *argv[]) { +#ifdef Q_OS_WIN +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) + // Set proper window title bar color on Windows + // https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 + QSettings registry("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", + QSettings::NativeFormat); + if (registry.value("AppsUseLightTheme").toInt() == 0) { qputenv("QT_QPA_PLATFORM", + "windows:darkmode=1"); } +#endif +#endif + #ifdef Q_OS_LINUX // Force XCB on Linux qputenv("QT_QPA_PLATFORM", "xcb");