--- a/QTfrontend/main.cpp Tue Mar 13 10:20:41 2018 -0400
+++ b/QTfrontend/main.cpp Tue Mar 13 16:38:48 2018 +0100
@@ -155,11 +155,29 @@
}
int main(int argc, char *argv[]) {
- /* Qt5 removed motif, plastique. These are now in 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. */
- // set windows initially
- QApplication::setStyle(QStyleFactory::create("windows"));
- // try setting plastique if available from qt5-style-plugins - in testing qt5 skips the call on fail to locate which leaves us on windows
- QApplication::setStyle(QStyleFactory::create("plastique"));
+ /* 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);