summaryrefslogtreecommitdiffstats
path: root/examples/opengl/qopenglwidget
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/qopenglwidget
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/qopenglwidget')
-rw-r--r--examples/opengl/qopenglwidget/main.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/opengl/qopenglwidget/main.cpp b/examples/opengl/qopenglwidget/main.cpp
index d7aa791142..ea90dca62f 100644
--- a/examples/opengl/qopenglwidget/main.cpp
+++ b/examples/opengl/qopenglwidget/main.cpp
@@ -51,6 +51,8 @@
#include <QApplication>
#include <QMainWindow>
#include <QSurfaceFormat>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
#include "mainwindow.h"
int main( int argc, char ** argv )
@@ -58,10 +60,21 @@ int main( int argc, char ** argv )
Q_INIT_RESOURCE(texture);
QApplication a( argc, argv );
+ QCoreApplication::setApplicationName("Qt QOpenGLWidget Example");
+ QCoreApplication::setOrganizationName("QtProject");
+ QCoreApplication::setApplicationVersion(QT_VERSION_STR);
+ QCommandLineParser parser;
+ parser.setApplicationDescription(QCoreApplication::applicationName());
+ parser.addHelpOption();
+ parser.addVersionOption();
+ QCommandLineOption multipleSampleOption("multisample", "Multisampling");
+ parser.addOption(multipleSampleOption);
+ parser.process(a);
+
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
- if (QCoreApplication::arguments().contains(QStringLiteral("--multisample")))
+ if (parser.isSet(multipleSampleOption))
format.setSamples(4);
QSurfaceFormat::setDefaultFormat(format);