diff options
Diffstat (limited to 'tests/manual/qopenglwidget/openglwidget')
4 files changed, 37 insertions, 98 deletions
diff --git a/tests/manual/qopenglwidget/openglwidget/CMakeLists.txt b/tests/manual/qopenglwidget/openglwidget/CMakeLists.txt new file mode 100644 index 0000000000..967feda558 --- /dev/null +++ b/tests/manual/qopenglwidget/openglwidget/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## openglwidget Binary: +##################################################################### + +qt_internal_add_manual_test(openglwidget + GUI + SOURCES + main.cpp + openglwidget.cpp openglwidget.h + NO_PCH_SOURCES + main.cpp # undef QT_NO_FOREACH + LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::OpenGL + Qt::OpenGLWidgets + Qt::Widgets + Qt::WidgetsPrivate +) diff --git a/tests/manual/qopenglwidget/openglwidget/main.cpp b/tests/manual/qopenglwidget/openglwidget/main.cpp index d2c11fdfd1..3a0e019b06 100644 --- a/tests/manual/qopenglwidget/openglwidget/main.cpp +++ b/tests/manual/qopenglwidget/openglwidget/main.cpp @@ -1,30 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "openglwidget.h" #include <QApplication> @@ -49,14 +26,13 @@ class Tools : public QObject Q_OBJECT public: - Tools(QWidget *root, QWidget *widgetToTurn, const QVector<QWidget *> glwidgets) + Tools(QWidget *root, QWidget *widgetToTurn, const QWidgetList &glwidgets) : m_root(root), m_widgetToTurn(widgetToTurn), m_glWidgets(glwidgets) { } void dump(); private slots: void turnNative(); void hideShowAllGL(); - void dumpCompositingStatus(); signals: void aboutToShowGLWidgets(); @@ -66,7 +42,7 @@ private: QWidget *m_root; QWidget *m_widgetToTurn; - QVector<QWidget *> m_glWidgets; + QWidgetList m_glWidgets; }; void Tools::turnNative() @@ -108,12 +84,6 @@ void Tools::dumpWidget(QWidget *w, int indent) } } -void Tools::dumpCompositingStatus() -{ - QWindow *w = m_root->window()->windowHandle(); - qDebug() << "Compositing status for" << w << m_root->window() << "is" << QWindowPrivate::get(w)->compositing; -} - class TabWidgetResetter : public QObject { Q_OBJECT @@ -212,16 +182,12 @@ int main(int argc, char *argv[]) sw->setWindowTitle("Tabs"); TabWidgetResetter twr(tw); - Tools t(&wnd, glw3, QVector<QWidget *>() << glw << glw2 << glw3 << glw4); + Tools t(&wnd, glw3, QWidgetList { glw, glw2, glw3, glw4 }); QObject::connect(&t, SIGNAL(aboutToShowGLWidgets()), &twr, SLOT(reset())); QMenu *toolsMenu = wnd.menuBar()->addMenu("&Tools"); toolsMenu->addAction("&Turn widgets (or some parent) into native", &t, SLOT(turnNative())); toolsMenu->addAction("&Hide/show all OpenGL widgets", &t, SLOT(hideShowAllGL())); - QTimer compStatusDumpTimer; - QObject::connect(&compStatusDumpTimer, SIGNAL(timeout()), &t, SLOT(dumpCompositingStatus())); - compStatusDumpTimer.start(5000); - wnd.show(); if (glw->isValid()) diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp index 031558a787..7e39945639 100644 --- a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp +++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define GL_GLEXT_PROTOTYPES @@ -39,7 +14,7 @@ #include <QtGui/QOpenGLFunctions> #include <QtGui/QGuiApplication> #include <QtGui/QMatrix4x4> -#include <QtGui/QOpenGLShaderProgram> +#include <QOpenGLShaderProgram> #include <QtGui/QScreen> #include <QtCore/qmath.h> diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.h b/tests/manual/qopenglwidget/openglwidget/openglwidget.h index 32fb4e2660..8366d17a11 100644 --- a/tests/manual/qopenglwidget/openglwidget/openglwidget.h +++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.h @@ -1,35 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef OPENGLWIDGET_H #define OPENGLWIDGET_H -#include <QtWidgets/QOpenGLWidget> +#include <QOpenGLWidget> #include <QtGui/QVector3D> class OpenGLWidgetPrivate; @@ -37,7 +12,7 @@ class OpenGLWidget : public QOpenGLWidget { Q_OBJECT public: - OpenGLWidget(int interval = 30, const QVector3D &rotAxis = QVector3D(0, 1, 0), QWidget *parent = 0); + OpenGLWidget(int interval = 30, const QVector3D &rotAxis = QVector3D(0, 1, 0), QWidget *parent = nullptr); ~OpenGLWidget(); void initializeGL(); |