Browse Source

Don't try to use QCoreApplication::arguments before an app is created

QGC4.4
Nate Weibley 9 years ago
parent
commit
80b7a1e9b1
  1. 16
      src/main.cc

16
src/main.cc

@ -145,11 +145,19 @@ int main(int argc, char *argv[]) @@ -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

Loading…
Cancel
Save