From 80b7a1e9b1a413f86ef5c5979367a1ddbd8ceeb2 Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Tue, 16 Feb 2016 18:48:14 -0500 Subject: [PATCH] Don't try to use QCoreApplication::arguments before an app is created --- src/main.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.cc b/src/main.cc index 22fdf1b..c2cdbf4 100644 --- a/src/main.cc +++ b/src/main.cc @@ -145,11 +145,19 @@ int main(int argc, char *argv[]) // Set our own OpenGL buglist qputenv("QT_OPENGL_BUGLIST", ":/opengl/resources/opengl/buglist.json"); - if (QCoreApplication::arguments().contains(QStringLiteral("-angle"))) { - QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); - } else if (QCoreApplication::arguments().contains(QStringLiteral("-swrast"))) { - QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + + // Allow for command line override of renderer + for (int i = 0; i < argc; i++) { + const QString arg(argv[i]); + if (arg == QStringLiteral("-angle")) { + QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); + break; + } else if (arg == QStringLiteral("-swrast")) { + QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + break; + } } + #endif // The following calls to qRegisterMetaType are done to silence debug output which warns