From f172b964f6d9fc8cadeb7b5efeb3f59c0f8f16f6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 24 Jan 2022 16:38:02 +0100 Subject: 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 --- examples/opengl/threadedqopenglwidget/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples/opengl/threadedqopenglwidget/main.cpp') 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 #include #include +#include #include #include +#include #include #include #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); -- cgit v1.2.3