summaryrefslogtreecommitdiffstats
path: root/examples/opengl/threadedqopenglwidget
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-08-29 16:21:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-05 10:54:15 +0000
commitb3717fc7f01ae078faf066538ddc80fca016ef0c (patch)
tree2324db6abe1995fbe9dd35fc6bd9ea83b464c787 /examples/opengl/threadedqopenglwidget
parentd64940891dffcb951f4b76426490cbc94fb4aba7 (diff)
OpenGL examples: Introduce QCommandLineParser
Task-number: QTBUG-60626 Change-Id: I6d102327c89206fcdce10f3ac04e112270b11ad2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'examples/opengl/threadedqopenglwidget')
-rw-r--r--examples/opengl/threadedqopenglwidget/main.cpp15
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);