diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-08-14 16:43:39 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-08-17 14:30:42 +0000 |
commit | 632d60d520ef2e5dcd8d64633b740759a83de876 (patch) | |
tree | a96eeed2de08628f17df682cd138220e798f7e1b /tests | |
parent | 164293bad95d8dc805feb6f055bb9dded19ee40b (diff) |
Add Object3D infra
Use Group (and Node) to crystalize the concepts.
Fix also some issues in Studio3DEngine.
Also changes the pureqml example to a manual test since Studio3DEngine and
friends are marked as internal for now, so shipping examples for them
along with the regular examples is not desirable yet.
Change-Id: I8ab0ad50d1b846cadb6927fcb38afe9dff576c2e
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 6 | ||||
-rw-r--r-- | tests/auto/studio3dengine/data/simple.qml | 22 | ||||
-rw-r--r-- | tests/auto/studio3dengine/studio3dengine.pro | 8 | ||||
-rw-r--r-- | tests/auto/studio3dengine/studio3dengine.qrc | 5 | ||||
-rw-r--r-- | tests/auto/studio3dengine/tst_studio3dengine.cpp | 334 | ||||
-rw-r--r-- | tests/manual/manual.pro | 4 | ||||
-rw-r--r-- | tests/manual/pureqml3d/main.cpp | 75 | ||||
-rw-r--r-- | tests/manual/pureqml3d/main.qml | 107 | ||||
-rw-r--r-- | tests/manual/pureqml3d/pureqml3d.pro | 11 | ||||
-rw-r--r-- | tests/manual/pureqml3d/pureqml3d.qrc | 5 |
10 files changed, 576 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 0d36323..3a06f0e 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -15,6 +15,10 @@ SUBDIRS += \ surfaceviewer \ q3dslancelot -qtHaveModule(quick): SUBDIRS += studio3d +qtHaveModule(quick) { + SUBDIRS += \ + studio3d \ + studio3dengine +} qtHaveModule(widgets): SUBDIRS += widget diff --git a/tests/auto/studio3dengine/data/simple.qml b/tests/auto/studio3dengine/data/simple.qml new file mode 100644 index 0000000..20a6c67 --- /dev/null +++ b/tests/auto/studio3dengine/data/simple.qml @@ -0,0 +1,22 @@ +import QtQuick 2.0 +import QtStudio3D 2.1 + +Rectangle { + id: root + color: "lightGray" + + Studio3DEngine { + id: s3d + } + + Layer3D { + engine: s3d + width: 200 + height: 200 + + Group3D { + Group3D { + } + } + } +} diff --git a/tests/auto/studio3dengine/studio3dengine.pro b/tests/auto/studio3dengine/studio3dengine.pro new file mode 100644 index 0000000..5f06355 --- /dev/null +++ b/tests/auto/studio3dengine/studio3dengine.pro @@ -0,0 +1,8 @@ +TARGET = tst_q3dsstudio3dengine +CONFIG += testcase + +QT += qml quick testlib 3dstudioruntime2-private + +SOURCES += tst_studio3dengine.cpp + +RESOURCES += studio3dengine.qrc diff --git a/tests/auto/studio3dengine/studio3dengine.qrc b/tests/auto/studio3dengine/studio3dengine.qrc new file mode 100644 index 0000000..c371efb --- /dev/null +++ b/tests/auto/studio3dengine/studio3dengine.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>data/simple.qml</file> + </qresource> +</RCC> diff --git a/tests/auto/studio3dengine/tst_studio3dengine.cpp b/tests/auto/studio3dengine/tst_studio3dengine.cpp new file mode 100644 index 0000000..4694e81 --- /dev/null +++ b/tests/auto/studio3dengine/tst_studio3dengine.cpp @@ -0,0 +1,334 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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$ +** +****************************************************************************/ + +#include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> + +#include <QtQuick/qquickitem.h> +#include <QtQuick/qquickview.h> +#include <QtCore/qurl.h> + +#include <private/q3dsuippresentation_p.h> +#include <private/q3dslayer3d_p.h> +#include <private/q3dsgroup3d_p.h> + +#include "../shared/shared.h" + +class tst_Studio3DEngine : public QObject +{ + Q_OBJECT + +public: + tst_Studio3DEngine(); + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + void testSimple(); + void testReparent(); + void testReparentSubTree(); + void testEngineChangeToNullAndBack(); + void testLayerParentNullAndBack(); +}; + +tst_Studio3DEngine::tst_Studio3DEngine() +{ +} + +void tst_Studio3DEngine::initTestCase() +{ + if (!isOpenGLGoodEnough()) + QSKIP("This platform does not support OpenGL proper"); + + QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat()); + + // do not bother disabling dialogs, Studio3DEngine is expected to avoid those implicitly +} + +void tst_Studio3DEngine::cleanupTestCase() +{ +} + +void tst_Studio3DEngine::testSimple() +{ + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QLatin1String("qrc:/data/simple.qml"))); + + QVERIFY(view.rootObject()); + QVERIFY(view.rootObject()->childItems().count() > 0); + + QQuickItem *s3d = view.rootObject()->childItems()[0]; + QVERIFY(s3d); + const QMetaObject *s3dMeta = s3d->metaObject(); + QVERIFY(!strcmp(s3dMeta->className(), "Q3DSStudio3DEngine")); + + view.resize(600, 500); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) + QSKIP("This test needs Qt Quick on OpenGL"); + + Q3DSLayer3D *layer3d = qobject_cast<Q3DSLayer3D *>(view.rootObject()->childItems()[1]); + QVERIFY(layer3d); + QCOMPARE(layer3d->engine(), s3d); + + Q3DSLayerNode *layer3DS = layer3d->layerNode(); + QVERIFY(layer3DS); + QCOMPARE(layer3DS->explicitSize(), layer3d->size() * view.effectiveDevicePixelRatio()); + + QCOMPARE(layer3d->childItems().count(), 1); + Q3DSGroup3D *group3d_1 = qobject_cast<Q3DSGroup3D *>(layer3d->childItems()[0]); + QVERIFY(group3d_1); + QCOMPARE(group3d_1->layer(), layer3d); + + QCOMPARE(group3d_1->object()->type(), Q3DSGraphObject::Group); + Q3DSGroupNode *group3DS_1 = static_cast<Q3DSGroupNode *>(group3d_1->object()); + QVERIFY(group3DS_1); + + QCOMPARE(group3d_1->childItems().count(), 1); + Q3DSGroup3D *group3d_2 = qobject_cast<Q3DSGroup3D *>(group3d_1->childItems()[0]); + QVERIFY(group3d_2); + QCOMPARE(group3d_2->layer(), layer3d); + + QCOMPARE(group3d_2->object()->type(), Q3DSGraphObject::Group); + Q3DSGroupNode *group3DS_2 = static_cast<Q3DSGroupNode *>(group3d_2->object()); + QVERIFY(group3DS_2); + + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(layer3DS->parent(), layer3d->presentation()->scene()); + + QVERIFY(layer3d->slide()->parent() == layer3d->presentation()->masterSlide()); + QVERIFY(!layer3d->slide()->nextSibling()); + const QSet<Q3DSGraphObject *> slideObjects = layer3d->slide()->objects(); + QCOMPARE(slideObjects.count(), 3); +} + +void tst_Studio3DEngine::testReparent() +{ + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QLatin1String("qrc:/data/simple.qml"))); + + view.resize(600, 500); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) + QSKIP("This test needs Qt Quick on OpenGL"); + + Q3DSLayer3D *layer3d = qobject_cast<Q3DSLayer3D *>(view.rootObject()->childItems()[1]); + Q3DSLayerNode *layer3DS = layer3d->layerNode(); + Q3DSGroup3D *group3d_1 = qobject_cast<Q3DSGroup3D *>(layer3d->childItems()[0]); + Q3DSGroupNode *group3DS_1 = static_cast<Q3DSGroupNode *>(group3d_1->object()); + Q3DSGroup3D *group3d_2 = qobject_cast<Q3DSGroup3D *>(group3d_1->childItems()[0]); + Q3DSGroupNode *group3DS_2 = static_cast<Q3DSGroupNode *>(group3d_2->object()); + + // Layer(Group1(Group2)) + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(layer3d->slide()->objects().count(), 3); + + // Layer(Group1 Group2) + group3d_2->setParentItem(layer3d); + QCOMPARE(group3DS_2->parent(), layer3DS); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(group3DS_1->nextSibling(), group3DS_2); + QCOMPARE(layer3d->slide()->objects().count(), 3); + + // Layer(Group2 Group1) + group3d_2->setParentItem(nullptr); + QCOMPARE(group3DS_2->parent(), nullptr); + QCOMPARE(group3d_2->layer(), nullptr); + group3d_1->setParentItem(nullptr); + QCOMPARE(group3DS_1->parent(), nullptr); + QCOMPARE(group3d_1->layer(), nullptr); + group3d_2->setParentItem(layer3d); + QCOMPARE(group3DS_2->parent(), layer3DS); + QCOMPARE(group3DS_2->nextSibling(), nullptr); + group3d_1->setParentItem(layer3d); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(group3d_1->layer(), layer3d); + QCOMPARE(group3DS_2->nextSibling(), group3DS_1); + QCOMPARE(group3d_2->layer(), layer3d); + QCOMPARE(layer3d->slide()->objects().count(), 3); + + // Layer(Group1) Group2 + group3d_2->setParentItem(nullptr); + QCOMPARE(group3d_2->object(), group3DS_2); + QCOMPARE(group3DS_2->parent(), nullptr); + QCOMPARE(group3DS_2->nextSibling(), nullptr); + QCOMPARE(group3d_2->layer(), nullptr); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(group3d_1->layer(), layer3d); + QCOMPARE(layer3d->slide()->objects().count(), 2); + + // Layer(Group1(Group2)) + group3d_2->setParentItem(group3d_1); + QCOMPARE(group3d_2->object(), group3DS_2); + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3d_2->layer(), layer3d); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(group3d_1->layer(), layer3d); + QCOMPARE(layer3d->slide()->objects().count(), 3); +} + +void tst_Studio3DEngine::testReparentSubTree() +{ + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QLatin1String("qrc:/data/simple.qml"))); + + view.resize(600, 500); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) + QSKIP("This test needs Qt Quick on OpenGL"); + + Q3DSLayer3D *layer3d = qobject_cast<Q3DSLayer3D *>(view.rootObject()->childItems()[1]); + Q3DSLayerNode *layer3DS = layer3d->layerNode(); + Q3DSGroup3D *group3d_1 = qobject_cast<Q3DSGroup3D *>(layer3d->childItems()[0]); + Q3DSGroupNode *group3DS_1 = static_cast<Q3DSGroupNode *>(group3d_1->object()); + Q3DSGroup3D *group3d_2 = qobject_cast<Q3DSGroup3D *>(group3d_1->childItems()[0]); + Q3DSGroupNode *group3DS_2 = static_cast<Q3DSGroupNode *>(group3d_2->object()); + + // Layer(Group1(Group2)) + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(layer3d->slide()->objects().count(), 3); + + // Layer Group1(Group2) + group3d_1->setParentItem(nullptr); + QCOMPARE(group3DS_1->parent(), nullptr); + QCOMPARE(group3d_1->layer(), nullptr); + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3d_2->layer(), nullptr); + QCOMPARE(layer3d->slide()->objects().count(), 1); + + // Layer Group1(Group2(Group3)) + // Group3 not activated at this point since the tree it gets added to is not live + Q3DSGroup3D *group3d_3 = new Q3DSGroup3D; + group3d_3->setParentItem(group3d_2); + QCOMPARE(group3d_3->layer(), nullptr); + QCOMPARE(group3d_3->object(), nullptr); + QCOMPARE(layer3d->slide()->objects().count(), 1); + + // Layer(Group1(Group2(Group3))) + group3d_1->setParentItem(layer3d); + QCOMPARE(group3DS_1->parent(), layer3DS); + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3d_3->object()->parent(), group3DS_2); + QCOMPARE(group3d_3->layer(), layer3d); + + Q3DSGroupNode *group3DS_3 = group3d_3->groupNode(); + QVERIFY(layer3d->slide()->objects().contains(group3DS_3)); + QCOMPARE(layer3d->slide()->objects().count(), 4); + + // Layer(Group1 Group2(Group3)) + group3d_2->setParentItem(nullptr); + QCOMPARE(group3d_2->object(), group3DS_2); + QCOMPARE(group3DS_2->parent(), nullptr); + QCOMPARE(group3d_2->layer(), nullptr); + QCOMPARE(group3d_3->object(), group3DS_3); + QCOMPARE(group3DS_3->parent(), group3DS_2); + QCOMPARE(group3d_3->layer(), nullptr); + + // Layer(Group1(Group2(Group3)) + group3d_2->setParentItem(group3d_1); + QCOMPARE(group3d_2->object(), group3DS_2); + QCOMPARE(group3DS_2->parent(), group3DS_1); + QCOMPARE(group3d_2->layer(), layer3d); + QCOMPARE(group3d_3->object(), group3DS_3); + QCOMPARE(group3DS_3->parent(), group3DS_2); + QCOMPARE(group3d_3->layer(), layer3d); +} + +void tst_Studio3DEngine::testEngineChangeToNullAndBack() +{ + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QLatin1String("qrc:/data/simple.qml"))); + + view.resize(600, 500); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) + QSKIP("This test needs Qt Quick on OpenGL"); + + QQuickItem *s3d = view.rootObject()->childItems()[0]; + Q3DSLayer3D *layer3d = qobject_cast<Q3DSLayer3D *>(view.rootObject()->childItems()[1]); + Q3DSLayerNode *layer3DS = layer3d->layerNode(); + + // nulling out the engine is valid, it leads to nulling the presentation + // but keeping all underlying objects alive [NB the engine cannot actually + // change to another Studio3DEngine since object IDs are not transferred + // between presentations] + + QCOMPARE(layer3DS->parent(), layer3d->presentation()->scene()); + layer3d->setEngine(nullptr); + QCOMPARE(layer3d->layerNode(), layer3DS); + QCOMPARE(layer3DS->parent(), nullptr); + QCOMPARE(layer3d->presentation(), nullptr); + + layer3d->setEngine(s3d); + QCOMPARE(layer3d->layerNode(), layer3DS); + QCOMPARE(layer3DS->parent(), layer3d->presentation()->scene()); +} + +void tst_Studio3DEngine::testLayerParentNullAndBack() +{ + QQuickView view; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QLatin1String("qrc:/data/simple.qml"))); + + view.resize(600, 500); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) + QSKIP("This test needs Qt Quick on OpenGL"); + + Q3DSLayer3D *layer3d = qobject_cast<Q3DSLayer3D *>(view.rootObject()->childItems()[1]); + Q3DSLayerNode *layer3DS = layer3d->layerNode(); + + QQuickItem *layerParent = layer3d->parentItem(); + layer3d->setParentItem(nullptr); + QCOMPARE(layer3d->layerNode(), layer3DS); + QVERIFY(layer3d->presentation()); + + layer3d->setParentItem(layerParent); + QCOMPARE(layer3d->layerNode(), layer3DS); +} + +QTEST_MAIN(tst_Studio3DEngine) + +#include "tst_studio3dengine.moc" diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index 5fe1eb4..6610fe6 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -5,3 +5,7 @@ qtHaveModule(widgets) { qt3dsexplorer \ datamodelgen } +qtHaveModule(quick) { + SUBDIRS += \ + pureqml3d +} diff --git a/tests/manual/pureqml3d/main.cpp b/tests/manual/pureqml3d/main.cpp new file mode 100644 index 0000000..814a6a0 --- /dev/null +++ b/tests/manual/pureqml3d/main.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $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 <QGuiApplication> +#include <QQuickView> +#include <q3dsruntimeglobal.h> + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + qputenv("QSG_INFO", "1"); + QGuiApplication app(argc, argv); + + // Use the ideal format (i.e. OpenGL version and profile) recommended by + // the Qt 3D Studio runtime. Without this the format set on the QQuickView + // would be used instead. + QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat()); + + QQuickView viewer; + viewer.setSource(QUrl("qrc:/main.qml")); + + viewer.setTitle(QStringLiteral("Qt 3D Studio Pure QML Example")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.resize(1280, 600); + viewer.show(); + + return app.exec(); +} diff --git a/tests/manual/pureqml3d/main.qml b/tests/manual/pureqml3d/main.qml new file mode 100644 index 0000000..d858416 --- /dev/null +++ b/tests/manual/pureqml3d/main.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtStudio3D 2.1 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.0 + +Rectangle { + id: root + color: "lightGray" + + Studio3DEngine { + id: s3d + } + + RowLayout { + width: parent.width + Repeater { + model: 4 + Rectangle { + border.color: "black" + border.width: 4 + color: "transparent" + width: 320 + height: 200 + + Layer3D { + engine: s3d + anchors.fill: parent + + Group3D { + } + } + } + } + } + + Button { + anchors.bottom: parent.bottom + text: "Profile UI" + onClicked: prof.visible = !prof.visible + focusPolicy: Qt.NoFocus + } + + Rectangle { + id: prof + visible: false + anchors.fill: parent + anchors.margins: 40 + border.color: "green" + border.width: 4 + color: "transparent" + + Studio3DProfiler { + anchors.fill: parent + focus: true + } + } +} diff --git a/tests/manual/pureqml3d/pureqml3d.pro b/tests/manual/pureqml3d/pureqml3d.pro new file mode 100644 index 0000000..b65b8e1 --- /dev/null +++ b/tests/manual/pureqml3d/pureqml3d.pro @@ -0,0 +1,11 @@ +TARGET = pureqml3d + +QT += quick 3dstudioruntime2 + +SOURCES += \ + main.cpp + +RESOURCES += pureqml3d.qrc + +OTHER_FILES += \ + main.qml diff --git a/tests/manual/pureqml3d/pureqml3d.qrc b/tests/manual/pureqml3d/pureqml3d.qrc new file mode 100644 index 0000000..5f6483a --- /dev/null +++ b/tests/manual/pureqml3d/pureqml3d.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> |