Use Fusion by default on Windows 11

The native Windows style doesn't look very nice
on Windows 11 so Fusion looks better in comparison,
see https://bugreports.qt.io/browse/QTBUG-97668.
This commit is contained in:
Martchus 2023-03-28 23:32:50 +02:00
parent 63b33810e5
commit 0ce5be5b2f
1 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,11 @@
#include <QStringBuilder>
#include <QStyleFactory>
#if defined(Q_OS_WINDOWS) && (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
#include <QOperatingSystemVersion>
#define QT_UTILITIES_USE_FUSION_ON_WINDOWS_11
#endif
#include <optional>
#include <iostream>
#include <memory>
@ -258,6 +263,15 @@ void QtSettings::apply()
} else if (m_d->initialFont.has_value()) {
QGuiApplication::setFont(m_d->initialFont.value());
}
#ifdef QT_UTILITIES_USE_FUSION_ON_WINDOWS_11
if (m_d->initialWidgetStyle.isEmpty()) {
// use Fusion on Windows 11 as the native style doesn't look good
// see https://bugreports.qt.io/browse/QTBUG-97668
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11) {
m_d->initialWidgetStyle = QStringLiteral("Fusion");
}
}
#endif
if (m_d->customWidgetStyle) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)
const auto *const currentStyle = QApplication::style();