diff options
Diffstat (limited to 'tests/qmlcamera/qml/qmlcamera/main.qml')
-rw-r--r-- | tests/qmlcamera/qml/qmlcamera/main.qml | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/tests/qmlcamera/qml/qmlcamera/main.qml b/tests/qmlcamera/qml/qmlcamera/main.qml index 444e175c..be4feca3 100644 --- a/tests/qmlcamera/qml/qmlcamera/main.qml +++ b/tests/qmlcamera/qml/qmlcamera/main.qml @@ -18,7 +18,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 -import QtDataVisualization 1.1 +import QtDataVisualization 1.2 import "." Rectangle { @@ -35,6 +35,15 @@ Rectangle { id: chartAxes } + Camera3D { + id: customCamera + wrapXRotation: false + xRotation: camControlArea.xValue + yRotation: camControlArea.yValue + zoomLevel: zoomSlider.value + target: Qt.vector3d(0.5, 0.5, 0.5) + } + Item { id: dataView width: parent.width - camControlArea.width @@ -60,21 +69,20 @@ Rectangle { columnAxis: chartAxes.column valueAxis: chartAxes.expenses - // Bind UI controls to the camera - scene.activeCamera.wrapXRotation: false - scene.activeCamera.xRotation: camControlArea.xValue - scene.activeCamera.yRotation: camControlArea.yValue - scene.activeCamera.zoomLevel: zoomSlider.value + scene.activeCamera: customCamera inputHandler: null customItemList: [shuttleItem, labelItem] + orthoProjection: true + + floorLevel: 10 } Custom3DItem { id: shuttleItem meshFile: ":/items/shuttle.obj" textureFile: ":/items/shuttle.png" - position: Qt.vector3d(5.0,29.0,3.0) + position: Qt.vector3d(2.0,29.0,2.0) scaling: Qt.vector3d(0.2,0.2,0.2) } @@ -82,7 +90,7 @@ Rectangle { id: labelItem facingCamera: true positionAbsolute: true - position: Qt.vector3d(0.0,1.5,0.0) + position: Qt.vector3d(-1.0,1.5,-1.0) scaling: Qt.vector3d(1.0,1.0,1.0) text: "Qt Shuttle" } @@ -162,6 +170,11 @@ Rectangle { currentAngle += 5 chartData.series.meshAngle = currentAngle shuttleItem.setRotationAxisAndAngle(Qt.vector3d(0.0, 1.0, 1.0), currentAngle) + console.log("label pos:", labelItem.position) + labelItem.position.x += 0.1 + labelItem.position.z += 0.1 + customCamera.target.x -= 0.1 + customCamera.target.z -= 0.1 } } @@ -203,4 +216,20 @@ Rectangle { } } } + + Button { + id: reflectionToggle + anchors.bottom: shuttleAdd.top + width: camControlArea.width + text: "Show reflections" + onClicked: { + if (testChart.reflection === true) { + text = "Show reflections" + testChart.reflection = false + } else { + text = "Hide reflections" + testChart.reflection = true + } + } + } } |