From 3babe8c73c7b0b5448543b34ae24b87d0bae01fb Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 20 Jun 2024 13:05:05 +0200 Subject: [PATCH] App: Set "windowsvista" style on Windows This will set the pre Qt 6.7 default style. Task-number: QTBUG-126515 Task-number: QTBUG-126548 Task-number: QTBUG-126549 Change-Id: I947bcbe859c91906f2a273a04f3142d8d42b7af1 Reviewed-by: Eike Ziller --- src/app/main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 4ec11d5e896..43712c6836a 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -680,11 +680,18 @@ int main(int argc, char **argv) setPixmapCacheLimit(); loadFonts(); - // On 100% or 200% scaling we can use the default 'Vista' style on Windows - qreal tmp; - const bool fractionalDpi = !qFuzzyIsNull(std::modf(qApp->devicePixelRatio(), &tmp)); - if (Utils::HostOsInfo::isWindowsHost() && fractionalDpi && !hasStyleOption) - QApplication::setStyle(QLatin1String("fusion")); + if (Utils::HostOsInfo::isWindowsHost() && !hasStyleOption) { + // The Windows 11 default style (Qt 6.7) has major issues, therefore + // set the previous default style: "windowsvista" + // FIXME: check newer Qt Versions + QApplication::setStyle(QLatin1String("windowsvista")); + + // On scaling different than 100% or 200% use the "fusion" style + qreal tmp; + const bool fractionalDpi = !qFuzzyIsNull(std::modf(qApp->devicePixelRatio(), &tmp)); + if (fractionalDpi) + QApplication::setStyle(QLatin1String("fusion")); + } const int threadCount = QThreadPool::globalInstance()->maxThreadCount(); QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));