From 9677851febf223cb3e74aa0d11edf95d0c08b919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 27 Jun 2019 09:47:07 +0300 Subject: Fix simpleqml example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reset source when window changes because it will cause new renderer to be created and it would not have proper source without it. - Update the example codes and resources - Change how the init timer is initialized to get proper result each time the presentation gets reloaded. Task-number: QT3DS-3681 Change-Id: I64d4f6980b87b6efcbb906bb4ad241956ce0a7bc Reviewed-by: Tomi Korpipää Reviewed-by: Miikka Heikkinen --- examples/studio3d/simpleqml/main.qml | 21 +++++++++++----- .../studio3d/simpleqml/presentation/barrel.uia | 28 +++++++++++----------- .../studio3d/simpleqml/presentation/barrel.uip | 16 ++++++------- 3 files changed, 37 insertions(+), 28 deletions(-) (limited to 'examples') diff --git a/examples/studio3d/simpleqml/main.qml b/examples/studio3d/simpleqml/main.qml index 06321a7..ed0278e 100644 --- a/examples/studio3d/simpleqml/main.qml +++ b/examples/studio3d/simpleqml/main.qml @@ -70,9 +70,13 @@ Rectangle { anchors.fill: parent property string textValue: "hello world" + ViewerSettings { + id: viewerSettings + } + Presentation { id: s3dpres - source: "qrc:/presentation/barrel.uip" + source: "qrc:/presentation/barrel.uia" onCustomSignalEmitted: customSignalName.text = Date.now() + ": " + name onSlideEntered: slideEnter.text = "Entered slide " + name + "(index " + index + ") on " + elementPath onSlideExited: slideExit.text = "Exited slide " + name + "(index " + index + ") on " + elementPath @@ -169,7 +173,11 @@ Rectangle { } Button { text: "Reload" - onClicked: s3dpres.reload() + onClicked: { + var src = s3dpres.source + s3dpres.source = "" + s3dpres.source = src + } focusPolicy: Qt.NoFocus } Button { @@ -185,9 +193,10 @@ Rectangle { } Button { text: "Toggle camera" + property bool eyeball: true onClicked: { - var v = s3dpres.getAttribute("Scene.Layer.Camera", "eyeball") - s3dpres.setAttribute("Scene.Layer.Camera", "eyeball", !v) + eyeball = !eyeball + s3dpres.setAttribute("Scene.Layer.Camera", "eyeball", eyeball) } focusPolicy: Qt.NoFocus } @@ -258,11 +267,11 @@ Rectangle { Button { id: profTogBtn - text: "Toggle profile UI" + text: "Toggle render stats" anchors.right: parent.right anchors.bottom: parent.bottom focusPolicy: Qt.NoFocus - onClicked: s3dpres.profileUiVisible = !s3dpres.profileUiVisible + onClicked: viewerSettings.showRenderStats = !viewerSettings.showRenderStats } Slider { id: profUiScale diff --git a/examples/studio3d/simpleqml/presentation/barrel.uia b/examples/studio3d/simpleqml/presentation/barrel.uia index d936e42..209d13a 100644 --- a/examples/studio3d/simpleqml/presentation/barrel.uia +++ b/examples/studio3d/simpleqml/presentation/barrel.uia @@ -1,16 +1,16 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/examples/studio3d/simpleqml/presentation/barrel.uip b/examples/studio3d/simpleqml/presentation/barrel.uip index 48b4edc..7b9b2fb 100644 --- a/examples/studio3d/simpleqml/presentation/barrel.uip +++ b/examples/studio3d/simpleqml/presentation/barrel.uip @@ -1,15 +1,15 @@ - + #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff - + - + @@ -17,8 +17,8 @@ - - + + @@ -34,14 +34,14 @@ 0 0 100 100 5 -302 100 100 10 0 100 100 0 0 100 100 5 0 100 100 10 0 100 100 - + 0 0 100 100 5 1 100 100 - + 0 100 100 100 5.009 43.75 100 100 10 100 100 100 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100 @@ -50,7 +50,7 @@ 0 1 100 100 5.009 0.235294 100 100 10 1 100 100 0 0 100 100 5.009 0.333333 100 100 10 0 100 100 - + -- cgit v1.2.3