feat(ui): use Fusion style on Windows 10 & 11 (#1495)

This enables dark mode support.

Fixes #811.
This commit is contained in:
Oleg Shparber 2023-04-30 04:05:22 -04:00 committed by GitHub
parent b5ca9e70dd
commit a524735129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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());