diff options
Diffstat (limited to 'examples/opengl/threadedqopenglwidget/main.cpp')
-rw-r--r-- | examples/opengl/threadedqopenglwidget/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp index c22cee9228..b9e491040f 100644 --- a/examples/opengl/threadedqopenglwidget/main.cpp +++ b/examples/opengl/threadedqopenglwidget/main.cpp @@ -53,6 +53,8 @@ #include <QDesktopWidget> #include <QSurfaceFormat> #include <QOpenGLContext> +#include <QCommandLineParser> +#include <QCommandLineOption> #include "mainwindow.h" #include "glwidget.h" @@ -67,6 +69,17 @@ int main( int argc, char ** argv ) { QApplication a( argc, argv ); + QCoreApplication::setApplicationName("Qt Threaded QOpenGLWidget Example"); + QCoreApplication::setOrganizationName("QtProject"); + QCoreApplication::setApplicationVersion(QT_VERSION_STR); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::applicationName()); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption singleOption("single", "Single thread"); + parser.addOption(singleOption); + parser.process(a); + QSurfaceFormat format; format.setDepthBufferSize(16); QSurfaceFormat::setDefaultFormat(format); @@ -93,7 +106,7 @@ int main( int argc, char ** argv ) QScopedPointer<MainWindow> mw1; QScopedPointer<MainWindow> mw2; - if (!QApplication::arguments().contains(QStringLiteral("--single"))) { + if (!parser.isSet(singleOption)) { if (supportsThreading) { pos += QPoint(100, 100); mw1.reset(new MainWindow); |