Detect Qt style after parameter parsing
authorWuzzy <Wuzzy2@mail.ru>
Fri, 20 Jul 2018 12:51:16 +0200
changeset 13525 873b7d32bc97
parent 13524 d44ca1f04bbe
child 13526 122e08d45caa
Detect Qt style after parameter parsing
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Fri Jul 20 02:43:38 2018 +0200
+++ b/QTfrontend/main.cpp	Fri Jul 20 12:51:16 2018 +0200
@@ -161,28 +161,6 @@
 }
 
 int main(int argc, char *argv[]) {
-    /* Qt5 Base removed Motif, Plastique. These are now in the Qt style plugins
-    (Ubuntu: qt5-style-plugins, which was NOT backported by Debian/Ubuntu to stable/LTS).
-    Windows appears to render best of the remaining options but still isn't quite right. */
-
-    // Try setting Plastique if available
-    QStyle* coreStyle;
-    coreStyle = QStyleFactory::create("Plastique");
-    if(coreStyle != 0) {
-        QApplication::setStyle(coreStyle);
-        qDebug("Qt style set: Plastique");
-    } else {
-        // Use Windows as fallback.
-        // FIXME: Under Windows style, some widgets like scrollbars don't render as nicely
-        coreStyle = QStyleFactory::create("Windows");
-        if(coreStyle != 0) {
-            QApplication::setStyle(coreStyle);
-            qDebug("Qt style set: Windows");
-        } else {
-            // Windows style should not be missing in Qt5 Base. If it does, something went terribly wrong!
-            qWarning("No Qt style could be set! Using the default one.");
-        }
-    }
 
     // Since we're calling this first, closeResources() will be the last thing called after main() returns.
     atexit(closeResources);
@@ -272,6 +250,29 @@
 
     // end of parameter parsing
 
+    // Select Qt style
+    /* Qt5 Base removed Motif, Plastique. These are now in the Qt style plugins
+    (Ubuntu: qt5-style-plugins, which was NOT backported by Debian/Ubuntu to stable/LTS).
+    Windows appears to render best of the remaining options but still isn't quite right. */
+
+    // Try setting Plastique if available
+    QStyle* coreStyle;
+    coreStyle = QStyleFactory::create("Plastique");
+    if(coreStyle != 0) {
+        QApplication::setStyle(coreStyle);
+        qDebug("Qt style set: Plastique");
+    } else {
+        // Use Windows as fallback.
+        // FIXME: Under Windows style, some widgets like scrollbars don't render as nicely
+        coreStyle = QStyleFactory::create("Windows");
+        if(coreStyle != 0) {
+            QApplication::setStyle(coreStyle);
+            qDebug("Qt style set: Windows");
+        } else {
+            // Windows style should not be missing in Qt5 Base. If it does, something went terribly wrong!
+            qWarning("No Qt style could be set! Using the default one.");
+        }
+    }
 
 #ifdef Q_OS_WIN
     QPixmap pixmap(":/res/splash.png");