summaryrefslogtreecommitdiffstats
path: root/tests/manual/render-qml-to-texture/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/render-qml-to-texture/main.cpp')
-rw-r--r--tests/manual/render-qml-to-texture/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/manual/render-qml-to-texture/main.cpp b/tests/manual/render-qml-to-texture/main.cpp
index a2fc6ed09..2420c8560 100644
--- a/tests/manual/render-qml-to-texture/main.cpp
+++ b/tests/manual/render-qml-to-texture/main.cpp
@@ -37,6 +37,8 @@
#include <QGuiApplication>
#include <QAnimationDriver>
#include <QPropertyAnimation>
+#include <QQmlComponent>
+#include <QQmlEngine>
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QAspectEngine>
@@ -87,7 +89,7 @@ int main(int argc, char *argv[])
while (frameGraphNode->childNodes().size() > 0)
frameGraphNode = (Qt3DRender::QFrameGraphNode*)frameGraphNode->childNodes().at(0);
view.defaultFrameGraph()->setClearColor(QColor::fromRgbF(1.0f, 1.0f, 1.0f));
- Qt3DRender::Quick::QScene2D* qmlTextureRenderer = new Qt3DRender::Quick::QScene2D(frameGraphNode);
+ Qt3DRender::Quick::QScene2D *qmlTextureRenderer = new Qt3DRender::Quick::QScene2D(frameGraphNode);
Qt3DRender::QTexture2D* offscreenTexture = new Qt3DRender::QTexture2D(qmlTextureRenderer);
offscreenTexture->setSize(1024, 1024);
@@ -102,7 +104,9 @@ int main(int argc, char *argv[])
output->setTexture(offscreenTexture);
qmlTextureRenderer->setOutput(output);
- qmlTextureRenderer->setSource(QUrl(QStringLiteral("qrc:/OffscreenGui.qml")));
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/OffscreenGui.qml")));
+ qmlTextureRenderer->setItem(static_cast<QQuickItem *>(component.create()));
Qt3DCore::QEntity* planeEntity = new Qt3DCore::QEntity(sceneRoot);
Qt3DExtras::QPlaneMesh* planeMesh = new Qt3DExtras::QPlaneMesh(planeEntity);