From: Camila Ayres Date: Wed, 7 Aug 2024 15:05:29 +0000 (+0200) Subject: Change default Qt quick control style depending on the platform. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~5^2~216^2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d8185e69c85c648b4fc8f9e8464f010d3ebd48f9;p=nextcloud-desktop.git Change default Qt quick control style depending on the platform. Signed-off-by: Camila Ayres --- diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 14b55dab7..b1794106a 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -70,10 +70,28 @@ int main(int argc, char **argv) QSurfaceFormat::setDefaultFormat(surfaceFormat); QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering); - QQuickStyle::setStyle(QStringLiteral("Fusion")); + + auto style = QStringLiteral("Fusion"); + +#ifdef Q_OS_MAC + style = QStringLiteral("macOS"); +#endif OCC::Application app(argc, argv); +#ifdef Q_OS_WIN + // The Windows style still has pixelated elements with Qt 5.6, + // it's recommended to use the Fusion style in this case, even + // though it looks slightly less native. Check here after the + // QApplication was constructed, but before any QWidget is + // constructed. + if (app.devicePixelRatio() > 1) { + style = "Windows"; + } +#endif // Q_OS_WIN + + QQuickStyle::setStyle(style); + #ifndef Q_OS_WIN signal(SIGPIPE, SIG_IGN); #endif