From 5ad042f44b2e65243cf52cf24b1701670f003346 Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 31 Mar 2020 21:12:19 -0400 Subject: [PATCH] Properly force default QML style The "mysterious segfault" was caused by KDE and its components hijacking the base QtQuick Controls. Use a more reliable method that changing env variables to force QML to use the fusion or default style, which has the base controls we expect. --- src/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 45e0923b..f3b10b5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,9 +18,6 @@ int main(int argc, char *argv[]) { - // Force a default universal QML style, we have our own theming mechanism - qputenv("QT_STYLE_OVERRIDE","Fusion"); - // Define some basic info about the app before creating the QApplication QApplication::setOrganizationName("mirage"); QApplication::setApplicationName("mirage"); @@ -29,6 +26,11 @@ int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); + // Force the default universal QML style, notably prevents + // KDE from hijacking base controls and messing up everything + QQuickStyle::setStyle("Fusion"); + QQuickStyle::setFallbackStyle("Default"); + // Register default theme fonts. Take the files from the // Qt resource system if possible (resources stored in the app executable), // else the local file system.