Merge pull request #7812 from nextcloud/bugfix/fluent-style

use correct qml style on Windows
This commit is contained in:
Matthieu Gallien 2025-01-31 16:00:43 +01:00 committed by GitHub
commit c151888683
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,25 +78,30 @@ int main(int argc, char **argv)
QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
auto style = QStringLiteral("Fusion");
auto qmlStyle = QStringLiteral("Fusion");
auto widgetsStyle = QStringLiteral("");
#if defined Q_OS_MAC
style = QStringLiteral("macOS");
#endif
QQuickStyle::setStyle(style);
QQuickStyle::setFallbackStyle(QStringLiteral("Fusion"));
#if defined Q_OS_WIN
qmlStyle = QStringLiteral("macOS");
#elif defined Q_OS_WIN
if (QOperatingSystemVersion::current().version() < QOperatingSystemVersion::Windows11.version()) {
QApplication::setStyle(QStyleFactory::create("Universal"));
qmlStyle = QStringLiteral("Universal");
widgetsStyle = QStringLiteral("Fusion");
} else {
style = QStringLiteral("FluentWinUI3");
qmlStyle = QStringLiteral("FluentWinUI3");
widgetsStyle = QStringLiteral("windows11");
}
#endif
QQuickStyle::setStyle(qmlStyle);
QQuickStyle::setFallbackStyle(QStringLiteral("Fusion"));
OCC::Application app(argc, argv);
if (!widgetsStyle.isEmpty()) {
QApplication::setStyle(QStyleFactory::create(widgetsStyle));
}
#ifndef Q_OS_WIN
signal(SIGPIPE, SIG_IGN);
#endif