aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-06 13:43:18 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-07 11:37:32 +0200
commit07d1dbcf7f1de03ae700894eaf1c63a33afc739a (patch)
treef6432d0b7506396e107b348f647a81a02cfdcf1b /examples/quick
parent494063ccc8f8619d11e3a4e85168d04c1211bf44 (diff)
Remove QSGEngine and move QSGAbstractRenderer back to private
QSGEngine goes away. Same for the associated example, which is the only place this is used anywhere in Qt. As a consequence, the renderer base class can be moved back to private: there is no use for it to be public anymore, since that made sense only in combination with QSGEngine. With the RHI-based rendering path driving a renderer directly is more complicated than before so it is not reasonable to allow the QSGEngine-style access anymore. Instead, one has QQuickRenderControl, which allows redirecting and manually driving the rendering of a QQuickWindow, thus providing an alternative to the legacy QSGEngine approach. Task-number: QTBUG-78596 Change-Id: If57c6b657b2053da1c4e545e517026382a71d998 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/scenegraph/scenegraph.pro1
-rw-r--r--examples/quick/scenegraph/sgengine/CMakeLists.txt116
-rw-r--r--examples/quick/scenegraph/sgengine/face-smile.pngbin15408 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/sgengine/main.cpp62
-rw-r--r--examples/quick/scenegraph/sgengine/sgengine.pro11
-rw-r--r--examples/quick/scenegraph/sgengine/sgengine.qrc5
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp254
-rw-r--r--examples/quick/scenegraph/sgengine/window.h95
8 files changed, 0 insertions, 544 deletions
diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro
index 08ca18fa0c..235b51cd72 100644
--- a/examples/quick/scenegraph/scenegraph.pro
+++ b/examples/quick/scenegraph/scenegraph.pro
@@ -4,7 +4,6 @@ qtConfig(opengl(es1|es2)?) {
SUBDIRS += \
graph \
simplematerial \
- sgengine \
fboitem \
openglunderqml \
textureinthread \
diff --git a/examples/quick/scenegraph/sgengine/CMakeLists.txt b/examples/quick/scenegraph/sgengine/CMakeLists.txt
deleted file mode 100644
index 7580796800..0000000000
--- a/examples/quick/scenegraph/sgengine/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# Generated from sgengine.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(sgengine LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/sgengine")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-
-add_qt_gui_executable(sgengine
- main.cpp
- window.cpp window.h
-)
-target_link_libraries(sgengine PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
-)
-
-
-# Resources:
-set(sgengine_resource_files
- "face-smile.png"
-)
-
-qt6_add_resources(sgengine "sgengine"
- PREFIX
- "/scenegraph/sgengine"
- FILES
- ${sgengine_resource_files}
-)
-set_source_files_properties("../../shared/Button.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Button.qml"
-)
-set_source_files_properties("../../shared/CheckBox.qml"
- PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml"
-)
-set_source_files_properties("../../shared/FlickrRssModel.qml"
- PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml"
-)
-set_source_files_properties("../../shared/Label.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Label.qml"
-)
-set_source_files_properties("../../shared/LauncherList.qml"
- PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml"
-)
-set_source_files_properties("../../shared/SimpleLauncherDelegate.qml"
- PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml"
-)
-set_source_files_properties("../../shared/Slider.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Slider.qml"
-)
-set_source_files_properties("../../shared/TabSet.qml"
- PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml"
-)
-set_source_files_properties("../../shared/TextField.qml"
- PROPERTIES QT_RESOURCE_ALIAS "TextField.qml"
-)
-set_source_files_properties("../../shared/images/back.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/back.png"
-)
-set_source_files_properties("../../shared/images/checkmark.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png"
-)
-set_source_files_properties("../../shared/images/next.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/next.png"
-)
-set_source_files_properties("../../shared/images/qt-logo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png"
-)
-set_source_files_properties("../../shared/images/slider_handle.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png"
-)
-set_source_files_properties("../../shared/images/tab.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/tab.png"
-)
-set(shared_resource_files
- "Button.qml"
- "CheckBox.qml"
- "FlickrRssModel.qml"
- "Label.qml"
- "LauncherList.qml"
- "SimpleLauncherDelegate.qml"
- "Slider.qml"
- "TabSet.qml"
- "TextField.qml"
- "images/back.png"
- "images/checkmark.png"
- "images/next.png"
- "images/qt-logo.png"
- "images/slider_handle.png"
- "images/tab.png"
-)
-
-qt6_add_resources(sgengine "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS sgengine
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quick/scenegraph/sgengine/face-smile.png b/examples/quick/scenegraph/sgengine/face-smile.png
deleted file mode 100644
index 3d66d72578..0000000000
--- a/examples/quick/scenegraph/sgengine/face-smile.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/sgengine/main.cpp b/examples/quick/scenegraph/sgengine/main.cpp
deleted file mode 100644
index a4dd3a6b72..0000000000
--- a/examples/quick/scenegraph/sgengine/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-#include <QGuiApplication>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window window;
- window.show();
-
- return app.exec();
-}
diff --git a/examples/quick/scenegraph/sgengine/sgengine.pro b/examples/quick/scenegraph/sgengine/sgengine.pro
deleted file mode 100644
index c6507a4982..0000000000
--- a/examples/quick/scenegraph/sgengine/sgengine.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-QT += quick
-
-HEADERS += window.h
-SOURCES += window.cpp main.cpp
-RESOURCES += \
- sgengine.qrc \
- ../../shared/shared.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/sgengine
-INSTALLS += target
diff --git a/examples/quick/scenegraph/sgengine/sgengine.qrc b/examples/quick/scenegraph/sgengine/sgengine.qrc
deleted file mode 100644
index 5d55bcfb6f..0000000000
--- a/examples/quick/scenegraph/sgengine/sgengine.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/scenegraph/sgengine">
- <file>face-smile.png</file>
- </qresource>
-</RCC>
diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp
deleted file mode 100644
index 6f22510a81..0000000000
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-
-#include <QOpenGLContext>
-#include <QSGAbstractRenderer>
-#include <QSGEngine>
-#include <QSGSimpleTextureNode>
-#include <QSGTransformNode>
-#include <QScreen>
-#include <QVariantAnimation>
-#include <QOpenGLFunctions>
-#include <QRandomGenerator>
-
-class Item {
-public:
- Item(QSGNode *parentNode, QSGTexture *texture, const QPointF &fromPos, const QPointF &toPos) {
- textureNode = new QSGSimpleTextureNode;
- textureNode->setRect(QRect(QPoint(), texture->textureSize()));
- textureNode->setTexture(texture);
-
- transformNode = new QSGTransformNode;
- transformNode->setFlag(QSGNode::OwnedByParent, false);
- transformNode->appendChildNode(textureNode);
- parentNode->appendChildNode(transformNode);
-
- int duration = QRandomGenerator::global()->generateDouble() * 400 + 800;
- rotAnimation.setStartValue(QRandomGenerator::global()->generateDouble() * 720 - 180);
- rotAnimation.setEndValue(QRandomGenerator::global()->generateDouble() * 720 - 180);
- rotAnimation.setDuration(duration);
- rotAnimation.start();
-
- posAnimation.setStartValue(fromPos);
- posAnimation.setEndValue(toPos);
- posAnimation.setDuration(duration);
- posAnimation.start();
- }
-
- ~Item() {
- delete transformNode;
- }
-
- bool isDone() const { return posAnimation.state() != QAbstractAnimation::Running; }
-
- void sync() {
- QPointF currentPos = posAnimation.currentValue().toPointF();
- QPointF center = textureNode->rect().center();
- QMatrix4x4 m;
- m.translate(currentPos.x(), currentPos.y());
- m.translate(center.x(), center.y());
- m.rotate(rotAnimation.currentValue().toFloat(), 0, 0, 1);
- m.translate(-center.x(), -center.y());
- transformNode->setMatrix(m);
- }
-
-private:
- QSGTransformNode *transformNode;
- QSGSimpleTextureNode *textureNode;
- QVariantAnimation posAnimation;
- QVariantAnimation rotAnimation;
-};
-
-Window::Window()
- : m_initialized(false)
- , m_context(new QOpenGLContext)
- , m_sgEngine(new QSGEngine)
- , m_sgRootNode(new QSGRootNode)
-{
- setSurfaceType(QWindow::OpenGLSurface);
- QRect g(0, 0, 640, 480);
- g.moveCenter(screen()->geometry().center());
- setGeometry(g);
- setTitle(QStringLiteral("Click me!"));
-
- QSurfaceFormat format;
- format.setDepthBufferSize(16);
- setFormat(format);
- m_context->setFormat(format);
- m_context->create();
-
- m_animationDriver.install();
- connect(&m_animationDriver, &QAnimationDriver::started, this, &Window::update);
-}
-
-Window::~Window()
-{
-}
-
-void Window::timerEvent(QTimerEvent *e)
-{
- if (e->timerId() == m_updateTimer.timerId()) {
- m_updateTimer.stop();
-
- if (!m_context->makeCurrent(this))
- return;
-
- if (!m_initialized)
- initialize();
-
- sync();
- render();
-
- if (m_animationDriver.isRunning()) {
- m_animationDriver.advance();
- update();
- }
- } else
- QWindow::timerEvent(e);
-}
-
-void Window::exposeEvent(QExposeEvent *)
-{
- if (isExposed())
- update();
- else
- invalidate();
-}
-
-void Window::mousePressEvent(QMouseEvent *)
-{
- addItems();
-}
-
-void Window::keyPressEvent(QKeyEvent *)
-{
- addItems();
-}
-
-void Window::addItems()
-{
- if (!m_initialized)
- return;
-
- QSGTexture *textures[] = { m_smileTexture.data(), m_qtTexture.data() };
- for (int i = 0; i < 50; ++i) {
- QSGTexture *tex = textures[i%2];
- QPointF fromPos(-tex->textureSize().width(), QRandomGenerator::global()->generateDouble() * (height() - tex->textureSize().height()));
- QPointF toPos(width(), QRandomGenerator::global()->generateDouble() * height() * 1.5 - height() * 0.25);
- m_items.append(QSharedPointer<Item>::create(m_sgRootNode.data(), tex, fromPos, toPos));
- }
- update();
-}
-
-void Window::update()
-{
- if (!m_updateTimer.isActive())
- m_updateTimer.start(0, this);
-}
-
-void Window::sync()
-{
- QList<QSharedPointer<Item> > validItems;
- for (QSharedPointer<Item> item : qAsConst(m_items)) {
- if (!item->isDone()) {
- validItems.append(item);
- item->sync();
- }
- }
- m_items.swap(validItems);
-}
-
-void Window::render()
-{
- m_sgRenderer->setDeviceRect(size());
- m_sgRenderer->setViewportRect(size());
- m_sgRenderer->setProjectionMatrixToRect(QRectF(QPointF(), size()));
- m_sgRenderer->renderScene();
-
- m_context->swapBuffers(this);
-}
-
-void Window::initialize()
-{
- m_sgEngine->initialize(m_context.data());
- m_sgRenderer.reset(m_sgEngine->createRenderer());
- m_sgRenderer->setRootNode(m_sgRootNode.data());
- m_sgRenderer->setClearColor(QColor(32, 32, 32));
-
- // With QSGEngine::createTextureFromId
- QOpenGLFunctions glFuncs(m_context.data());
- GLuint glTexture;
- glFuncs.glGenTextures(1, &glTexture);
- glFuncs.glBindTexture(GL_TEXTURE_2D, glTexture);
- QImage smile = QImage(":/scenegraph/sgengine/face-smile.png").scaled(48, 48, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- smile = smile.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
- Q_ASSERT(!smile.isNull());
- glFuncs.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, smile.width(), smile.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, smile.constBits());
- m_smileTexture.reset(m_sgEngine->createTextureFromId(glTexture, smile.size(), QFlag(QSGEngine::TextureOwnsGLTexture | QSGEngine::TextureHasAlphaChannel)));
-
- // With QSGEngine::createTextureFromImage
- QImage qtLogo = QImage(":/shared/images/qt-logo.png").scaled(48, 48, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- Q_ASSERT(!qtLogo.isNull());
- m_qtTexture.reset(m_sgEngine->createTextureFromImage(qtLogo));
- m_initialized = true;
-}
-
-void Window::invalidate()
-{
- m_updateTimer.stop();
- m_items.clear();
- m_smileTexture.reset();
- m_qtTexture.reset();
- m_sgRenderer.reset();
- m_sgEngine->invalidate();
- m_initialized = false;
-}
diff --git a/examples/quick/scenegraph/sgengine/window.h b/examples/quick/scenegraph/sgengine/window.h
deleted file mode 100644
index 1b27467b06..0000000000
--- a/examples/quick/scenegraph/sgengine/window.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QWindow>
-
-#include <QAnimationDriver>
-#include <QBasicTimer>
-#include <QSharedPointer>
-
-class Item;
-QT_FORWARD_DECLARE_CLASS(QSGAbstractRenderer)
-QT_FORWARD_DECLARE_CLASS(QSGEngine)
-QT_FORWARD_DECLARE_CLASS(QSGRootNode)
-QT_FORWARD_DECLARE_CLASS(QSGTexture)
-
-class Window : public QWindow
-{
- Q_OBJECT
-public:
- Window();
- ~Window();
-
- void addItems();
- void update();
-
-private:
- void timerEvent(QTimerEvent *);
- void exposeEvent(QExposeEvent *);
- void mousePressEvent(QMouseEvent *);
- void keyPressEvent(QKeyEvent *);
-
- void sync();
- void render();
- void initialize();
- void invalidate();
-
- bool m_initialized;
- QScopedPointer<QOpenGLContext> m_context;
- QScopedPointer<QSGEngine> m_sgEngine;
- QScopedPointer<QSGRootNode> m_sgRootNode;
- QScopedPointer<QSGAbstractRenderer> m_sgRenderer;
- QScopedPointer<QSGTexture> m_smileTexture;
- QScopedPointer<QSGTexture> m_qtTexture;
- QList<QSharedPointer<Item> > m_items;
-
- QBasicTimer m_updateTimer;
- QAnimationDriver m_animationDriver;
-};