Detect Qt style after parameter parsing 0.9.24
authorWuzzy <Wuzzy2@mail.ru>
Tue, 24 Jul 2018 18:37:52 +0200
branch0.9.24
changeset 13549 b69732d0cce5
parent 13548 dfde8aad6b3e
child 13550 8b89bdb3c3dd
Detect Qt style after parameter parsing
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Tue Jul 24 18:37:52 2018 +0200
+++ b/QTfrontend/main.cpp	Tue Jul 24 18:37:52 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");