summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellogl2/main.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-09-06 13:26:31 +0200
committerLiang Qi <liang.qi@qt.io>2017-09-06 13:26:31 +0200
commit19dd2ca93b8b95a5e2792b29ed62ea23800fb53e (patch)
tree17685d2a9628ec5936155e09da3edd74c9244b0e /examples/opengl/hellogl2/main.cpp
parent942922652481347659a0dae78758c334778a58d2 (diff)
parentd332a2d3ccb485c9decd6c47fa5a5fc02b59d27e (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: examples/opengl/qopenglwidget/main.cpp src/3rdparty/pcre2/src/pcre2_printint.c src/plugins/platforms/cocoa/qnsview.mm src/widgets/widgets/qcombobox.cpp Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
Diffstat (limited to 'examples/opengl/hellogl2/main.cpp')
-rw-r--r--examples/opengl/hellogl2/main.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/examples/opengl/hellogl2/main.cpp b/examples/opengl/hellogl2/main.cpp
index 143f659eb6..b52a5a37d3 100644
--- a/examples/opengl/hellogl2/main.cpp
+++ b/examples/opengl/hellogl2/main.cpp
@@ -51,25 +51,46 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QSurfaceFormat>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
+#include "glwidget.h"
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ QCoreApplication::setApplicationName("Qt Hello GL 2 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);
+ QCommandLineOption coreProfileOption("coreprofile", "Use core profile");
+ parser.addOption(coreProfileOption);
+ QCommandLineOption transparentOption("transparent", "Transparent window");
+ parser.addOption(transparentOption);
+
+ parser.process(app);
+
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
- if (QCoreApplication::arguments().contains(QStringLiteral("--multisample")))
+ if (parser.isSet(multipleSampleOption))
fmt.setSamples(4);
- if (QCoreApplication::arguments().contains(QStringLiteral("--coreprofile"))) {
+ if (parser.isSet(coreProfileOption)) {
fmt.setVersion(3, 2);
fmt.setProfile(QSurfaceFormat::CoreProfile);
}
QSurfaceFormat::setDefaultFormat(fmt);
MainWindow mainWindow;
- if (QCoreApplication::arguments().contains(QStringLiteral("--transparent"))) {
+
+ GLWidget::setTransparent(parser.isSet(transparentOption));
+ if (GLWidget::isTransparent()) {
mainWindow.setAttribute(Qt::WA_TranslucentBackground);
mainWindow.setAttribute(Qt::WA_NoSystemBackground, false);
}