# HG changeset patch # User Wuzzy # Date 1532083876 -7200 # Node ID 873b7d32bc97a69ce67339552ab8640b3a0a1e7c # Parent d44ca1f04bbe864928ea8c932c46ea70c0d1911e Detect Qt style after parameter parsing diff -r d44ca1f04bbe -r 873b7d32bc97 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");