summaryrefslogtreecommitdiffstats
path: root/examples/opengl/threadedqopenglwidget/main.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2022-01-24 16:38:02 +0100
committerFriedemann Kleint <[email protected]>2022-01-25 15:54:05 +0100
commitf172b964f6d9fc8cadeb7b5efeb3f59c0f8f16f6 (patch)
tree2824827877b7971fe8b4834acdbada107ca5b26b /examples/opengl/threadedqopenglwidget/main.cpp
parent2d95b7534530fec1e1e52ef7e8be289abb48b822 (diff)
threadedqopenglwidget example: Split out class Renderer
This makes the code clearer and decouples it from the GLWidget. As a drive-by, add a global shortcut to close. Pick-to: 6.3 6.2 Change-Id: I3469d29bc367acc17c5f8acf9d46219259b8315b Reviewed-by: Laszlo Agocs <[email protected]>
Diffstat (limited to 'examples/opengl/threadedqopenglwidget/main.cpp')
-rw-r--r--examples/opengl/threadedqopenglwidget/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp
index 975def030bf..2553d7754bb 100644
--- a/examples/opengl/threadedqopenglwidget/main.cpp
+++ b/examples/opengl/threadedqopenglwidget/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -51,8 +51,10 @@
#include <QApplication>
#include <QMainWindow>
#include <QScreen>
+#include <QShortcut>
#include <QSurfaceFormat>
#include <QOpenGLContext>
+#include <QOpenGLFunctions>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "mainwindow.h"
@@ -95,6 +97,8 @@ int main( int argc, char ** argv )
topLevelGlWidget.resize(200, 200);
topLevelGlWidget.move(pos);
topLevelGlWidget.show();
+ auto *closeShortcut = new QShortcut(Qt::CTRL | Qt::Key_Q, &a, QApplication::closeAllWindows);
+ closeShortcut->setContext(Qt::ApplicationShortcut);
const QString glInfo = getGlString(topLevelGlWidget.context()->functions(), GL_VENDOR)
+ QLatin1Char('/') + getGlString(topLevelGlWidget.context()->functions(), GL_RENDERER);