Use `QWizard::AeroStyle` also with Qt 6.7's `windows11` style

This is likely going to work as the `windows11` style seems to be a
continuation of the `windowsvista` so let's give it a try.
This commit is contained in:
Martchus 2023-12-15 15:49:31 +01:00
parent 14bdc91388
commit 8cac56c246
1 changed files with 4 additions and 2 deletions

View File

@ -55,12 +55,14 @@ Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags)
: QWizard(parent, flags)
{
#ifdef Q_OS_WINDOWS
// avoid using QWizard::AeroStyle when not also the Qt Widgets style "windowsvista" is used
// avoid using QWizard::AeroStyle when not also the Qt Widgets style "windowsvista"/"windows11" is used
// note: Otherwise the wizard is quite unusable with a dark color palette.
auto fallbackToModernStyle = false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)
if (const auto *const style = QApplication::style()) {
if (style->name().compare(QLatin1String("windowsvista"), Qt::CaseInsensitive) != 0) {
const auto name = style->name();
if (name.compare(QLatin1String("windowsvista"), Qt::CaseInsensitive) != 0
&& name.compare(QLatin1String("windows11"), Qt::CaseInsensitive) != 0) {
setWizardStyle(QWizard::ModernStyle);
fallbackToModernStyle = true;
}