Skip to content

Commit

Permalink
Set proper window title bar color on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Apr 18, 2024
1 parent 8f3eebd commit ff07a5e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit ff07a5e

Please sign in to comment.