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.
This commit is contained in:
miruka 2020-03-31 21:12:19 -04:00
parent ad937573cf
commit 5ad042f44b

View File

@ -18,9 +18,6 @@
int main(int argc, char *argv[]) { 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 // Define some basic info about the app before creating the QApplication
QApplication::setOrganizationName("mirage"); QApplication::setOrganizationName("mirage");
QApplication::setApplicationName("mirage"); QApplication::setApplicationName("mirage");
@ -29,6 +26,11 @@ int main(int argc, char *argv[]) {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv); 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 // Register default theme fonts. Take the files from the
// Qt resource system if possible (resources stored in the app executable), // Qt resource system if possible (resources stored in the app executable),
// else the local file system. // else the local file system.