summaryrefslogtreecommitdiffstats
path: root/tests/manual/qmlcamera/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qmlcamera/qml')
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/Axes.qml49
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/ControlSurface.qml56
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/Data.qml144
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/main.qml238
4 files changed, 487 insertions, 0 deletions
diff --git a/tests/manual/qmlcamera/qml/qmlcamera/Axes.qml b/tests/manual/qmlcamera/qml/qmlcamera/Axes.qml
new file mode 100644
index 00000000..ec7933e5
--- /dev/null
+++ b/tests/manual/qmlcamera/qml/qmlcamera/Axes.qml
@@ -0,0 +1,49 @@
+/******************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Data Visualization module.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** $QT_END_LICENSE$
+**
+******************************************************************************/
+
+import QtQuick 2.1
+import QtDataVisualization 1.0
+
+Item {
+ property alias column: columnAxis
+ property alias expenses: expensesAxis
+ property alias income: incomeAxis
+
+ // For row labels we can use row labels from data proxy, so default axis
+ // suffices for rows.
+
+ // Custom labels for columns, since the data contains abbreviated month names.
+ CategoryAxis3D {
+ id: columnAxis
+ labels: ["January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"]
+ }
+ ValueAxis3D {
+ id: incomeAxis
+ labelFormat: "%.2f M\u20AC"
+ title: "Monthly income"
+ }
+ ValueAxis3D {
+ id: expensesAxis
+ labelFormat: "-%.2f M\u20AC"
+ title: "Monthly expenses"
+ }
+}
diff --git a/tests/manual/qmlcamera/qml/qmlcamera/ControlSurface.qml b/tests/manual/qmlcamera/qml/qmlcamera/ControlSurface.qml
new file mode 100644
index 00000000..25553776
--- /dev/null
+++ b/tests/manual/qmlcamera/qml/qmlcamera/ControlSurface.qml
@@ -0,0 +1,56 @@
+/******************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Data Visualization module.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** $QT_END_LICENSE$
+**
+******************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: controlRect
+ color: "#000000"
+ property real xValue : 0
+ property real yValue : 0
+ property real minXValue : 0
+ property real minYValue : 0
+ property real maxXValue : 0
+ property real maxYValue : 0
+
+ property real halfWidth: width / 2.0;
+ property real halfHeight: height / 2.0;
+
+ Rectangle {
+ id: pointer
+ color: "#FFFFFF"
+ width: 5
+ height: 5
+ }
+
+ MouseArea {
+ id: inputArea
+ anchors.fill: parent
+ onPositionChanged: {
+ pointer.x = Math.min(Math.max(0, mouse.x), controlRect.width - pointer.width );
+ pointer.y = Math.min(Math.max(0, mouse.y), controlRect.height - pointer.height);
+ var mixX = (mouse.x / controlRect.width);
+ var mixY = (mouse.y / controlRect.width);
+ controlRect.xValue = minXValue*(1-mixX) + maxXValue*mixX;
+ controlRect.yValue = minYValue*(1-mixY) + maxYValue*mixY;
+ }
+ }
+}
diff --git a/tests/manual/qmlcamera/qml/qmlcamera/Data.qml b/tests/manual/qmlcamera/qml/qmlcamera/Data.qml
new file mode 100644
index 00000000..08764615
--- /dev/null
+++ b/tests/manual/qmlcamera/qml/qmlcamera/Data.qml
@@ -0,0 +1,144 @@
+/******************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Data Visualization module.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** $QT_END_LICENSE$
+**
+******************************************************************************/
+
+import QtQuick 2.1
+import QtDataVisualization 1.1
+
+Item {
+ property alias model: dataModel
+ property alias proxy: modelProxy
+ property alias series: barSeries
+
+ ItemModelBarDataProxy {
+ id: modelProxy
+ itemModel: dataModel
+ rowRole: "year"
+ columnRole: "month"
+ valueRole: "expenses"
+ rotationRole: "angle"
+ valueRolePattern: /@*(\d*)t*/
+ rotationRolePattern: /jjj/
+ valueRoleReplace: "\\1"
+ rotationRoleReplace: "1"
+ }
+
+ Bar3DSeries {
+ id: barSeries
+ dataProxy: modelProxy
+ itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel"
+
+ onMeshAngleChanged: console.log("angle changed:", angle)
+ }
+
+ ListModel {
+ id: dataModel
+ ListElement{ year: "2006"; month: "Jan"; expenses: "@@4ttt"; angle: "jjj1"; income: "5" }
+ ListElement{ year: "2006"; month: "Feb"; expenses: "@@5ttt"; angle: "jjj2"; income: "6" }
+ ListElement{ year: "2006"; month: "Mar"; expenses: "@@7ttt"; angle: "jjj3"; income: "4" }
+ ListElement{ year: "2006"; month: "Apr"; expenses: "@@3ttt"; angle: "jjj4"; income: "2" }
+ ListElement{ year: "2006"; month: "May"; expenses: "@@4ttt"; angle: "jjj5"; income: "1" }
+ ListElement{ year: "2006"; month: "Jun"; expenses: "@@2ttt"; angle: "jjj6"; income: "2" }
+ ListElement{ year: "2006"; month: "Jul"; expenses: "@@1ttt"; angle: "jjj7"; income: "3" }
+ ListElement{ year: "2006"; month: "Aug"; expenses: "@@5ttt"; angle: "jjj8"; income: "1" }
+ ListElement{ year: "2006"; month: "Sep"; expenses: "@@2ttt"; angle: "jjj9"; income: "3" }
+ ListElement{ year: "2006"; month: "Oct"; expenses: "@@5ttt"; angle: "jjj10"; income: "2" }
+ ListElement{ year: "2006"; month: "Nov"; expenses: "@@8ttt"; angle: "jjj11"; income: "5" }
+ ListElement{ year: "2006"; month: "Dec"; expenses: "@@3ttt"; angle: "jjj12"; income: "3" }
+
+ ListElement{ year: "2007"; month: "Jan"; expenses: "@@3ttt"; angle: "jjj13"; income: "1" }
+ ListElement{ year: "2007"; month: "Feb"; expenses: "@@4ttt"; angle: "jjj14"; income: "2" }
+ ListElement{ year: "2007"; month: "Mar"; expenses: "@@12ttt"; angle: "jjj15"; income: "4" }
+ ListElement{ year: "2007"; month: "Apr"; expenses: "@@13ttt"; angle: "jjj16"; income: "6" }
+ ListElement{ year: "2007"; month: "May"; expenses: "@@14ttt"; angle: "jjj17"; income: "11" }
+ ListElement{ year: "2007"; month: "Jun"; expenses: "@@7ttt"; angle: "jjj18"; income: "7" }
+ ListElement{ year: "2007"; month: "Jul"; expenses: "@@6ttt"; angle: "jjj19"; income: "4" }
+ ListElement{ year: "2007"; month: "Aug"; expenses: "@@4ttt"; angle: "jjj20"; income: "15" }
+ ListElement{ year: "2007"; month: "Sep"; expenses: "@@2ttt"; angle: "jjj21"; income: "18" }
+ ListElement{ year: "2007"; month: "Oct"; expenses: "@@29ttt"; angle: "jjj22"; income: "25" }
+ ListElement{ year: "2007"; month: "Nov"; expenses: "@@23ttt"; angle: "jjj23"; income: "29" }
+ ListElement{ year: "2007"; month: "Dec"; expenses: "@@5ttt"; angle: "jjj24"; income: "9" }
+
+ ListElement{ year: "2008"; month: "Jan"; expenses: "@@3"; income: "8" }
+ ListElement{ year: "2008"; month: "Feb"; expenses: "@@8"; income: "14" }
+ ListElement{ year: "2008"; month: "Mar"; expenses: "@@10"; income: "20" }
+ ListElement{ year: "2008"; month: "Apr"; expenses: "@@12"; income: "24" }
+ ListElement{ year: "2008"; month: "May"; expenses: "@@10"; income: "19" }
+ ListElement{ year: "2008"; month: "Jun"; expenses: "@@5"; income: "8" }
+ ListElement{ year: "2008"; month: "Jul"; expenses: "@@1"; income: "4" }
+ ListElement{ year: "2008"; month: "Aug"; expenses: "@@7"; income: "12" }
+ ListElement{ year: "2008"; month: "Sep"; expenses: "@@4"; income: "16" }
+ ListElement{ year: "2008"; month: "Oct"; expenses: "@@22"; income: "33" }
+ ListElement{ year: "2008"; month: "Nov"; expenses: "@@16"; income: "25" }
+ ListElement{ year: "2008"; month: "Dec"; expenses: "@@2"; income: "7" }
+
+ ListElement{ year: "2009"; month: "Jan"; expenses: "@@4ttt"; angle: "jjj37"; income: "5" }
+ ListElement{ year: "2009"; month: "Feb"; expenses: "@@4ttt"; angle: "jjj38"; income: "7" }
+ ListElement{ year: "2009"; month: "Mar"; expenses: "@@11ttt"; angle: "jjj39"; income: "14" }
+ ListElement{ year: "2009"; month: "Apr"; expenses: "@@16ttt"; angle: "jjj40"; income: "22" }
+ ListElement{ year: "2009"; month: "May"; expenses: "@@3ttt"; angle: "jjj41"; income: "5" }
+ ListElement{ year: "2009"; month: "Jun"; expenses: "@@4ttt"; angle: "jjj42"; income: "8" }
+ ListElement{ year: "2009"; month: "Jul"; expenses: "@@7ttt"; angle: "jjj43"; income: "9" }
+ ListElement{ year: "2009"; month: "Aug"; expenses: "@@9ttt"; angle: "jjj44"; income: "13" }
+ ListElement{ year: "2009"; month: "Sep"; expenses: "@@1ttt"; angle: "jjj45"; income: "6" }
+ ListElement{ year: "2009"; month: "Oct"; expenses: "@@14ttt"; angle: "jjj46"; income: "25" }
+ ListElement{ year: "2009"; month: "Nov"; expenses: "@@19ttt"; angle: "jjj47"; income: "29" }
+ ListElement{ year: "2009"; month: "Dec"; expenses: "@@5ttt"; angle: "jjj48"; income: "7" }
+
+ ListElement{ year: "2010"; month: "Jan"; expenses: "@@14ttt"; angle: "jjj49"; income: "22" }
+ ListElement{ year: "2010"; month: "Feb"; expenses: "@@5ttt"; angle: "jjj50"; income: "7" }
+ ListElement{ year: "2010"; month: "Mar"; expenses: "@@1ttt"; angle: "jjj51"; income: "9" }
+ ListElement{ year: "2010"; month: "Apr"; expenses: "@@1ttt"; angle: "jjj52"; income: "12" }
+ ListElement{ year: "2010"; month: "May"; expenses: "@@5ttt"; angle: "jjj53"; income: "9" }
+ ListElement{ year: "2010"; month: "Jun"; expenses: "@@5ttt"; angle: "jjj54"; income: "8" }
+ ListElement{ year: "2010"; month: "Jul"; expenses: "@@3ttt"; angle: "jjj55"; income: "7" }
+ ListElement{ year: "2010"; month: "Aug"; expenses: "@@1ttt"; angle: "jjj56"; income: "5" }
+ ListElement{ year: "2010"; month: "Sep"; expenses: "@@2ttt"; angle: "jjj57"; income: "4" }
+ ListElement{ year: "2010"; month: "Oct"; expenses: "@@10ttt"; angle: "jjj58"; income: "13" }
+ ListElement{ year: "2010"; month: "Nov"; expenses: "@@12ttt"; angle: "jjj59"; income: "17" }
+ ListElement{ year: "2010"; month: "Dec"; expenses: "@@6ttt"; angle: "jjj60"; income: "9" }
+
+ ListElement{ year: "2011"; month: "Jan"; expenses: "@@2ttt"; angle: "jjj61"; income: "6" }
+ ListElement{ year: "2011"; month: "Feb"; expenses: "@@4ttt"; angle: "jjj62"; income: "8" }
+ ListElement{ year: "2011"; month: "Mar"; expenses: "@@7ttt"; angle: "jjj63"; income: "12" }
+ ListElement{ year: "2011"; month: "Apr"; expenses: "@@9ttt"; angle: "jjj64"; income: "15" }
+ ListElement{ year: "2011"; month: "May"; expenses: "@@7ttt"; angle: "jjj65"; income: "19" }
+ ListElement{ year: "2011"; month: "Jun"; expenses: "@@9ttt"; angle: "jjj66"; income: "18" }
+ ListElement{ year: "2011"; month: "Jul"; expenses: "@@13ttt"; angle: "jjj67"; income: "17" }
+ ListElement{ year: "2011"; month: "Aug"; expenses: "@@5ttt"; angle: "jjj68"; income: "9" }
+ ListElement{ year: "2011"; month: "Sep"; expenses: "@@3ttt"; angle: "jjj69"; income: "8" }
+ ListElement{ year: "2011"; month: "Oct"; expenses: "@@13ttt"; angle: "jjj70"; income: "15" }
+ ListElement{ year: "2011"; month: "Nov"; expenses: "@@8ttt"; angle: "jjj71"; income: "17" }
+ ListElement{ year: "2011"; month: "Dec"; expenses: "@@7ttt"; angle: "jjj72"; income: "10" }
+
+ ListElement{ year: "2012"; month: "Jan"; expenses: "@@12ttt"; angle: "jjj73"; income: "16" }
+ ListElement{ year: "2012"; month: "Feb"; expenses: "@@24ttt"; angle: "jjj74"; income: "28" }
+ ListElement{ year: "2012"; month: "Mar"; expenses: "@@27ttt"; angle: "jjj75"; income: "22" }
+ ListElement{ year: "2012"; month: "Apr"; expenses: "@@29ttt"; angle: "jjj76"; income: "25" }
+ ListElement{ year: "2012"; month: "May"; expenses: "@@27ttt"; angle: "jjj77"; income: "29" }
+ ListElement{ year: "2012"; month: "Jun"; expenses: "@@19ttt"; angle: "jjj78"; income: "18" }
+ ListElement{ year: "2012"; month: "Jul"; expenses: "@@13ttt"; angle: "jjj79"; income: "17" }
+ ListElement{ year: "2012"; month: "Aug"; expenses: "@@15ttt"; angle: "jjj80"; income: "19" }
+ ListElement{ year: "2012"; month: "Sep"; expenses: "@@3ttt"; angle: "jjj81"; income: "8" }
+ ListElement{ year: "2012"; month: "Oct"; expenses: "@@3ttt"; angle: "jjj82"; income: "6" }
+ ListElement{ year: "2012"; month: "Nov"; expenses: "@@4ttt"; angle: "jjj83"; income: "8" }
+ ListElement{ year: "2012"; month: "Dec"; expenses: "@@5ttt"; angle: "jjj84"; income: "9" }
+ }
+}
diff --git a/tests/manual/qmlcamera/qml/qmlcamera/main.qml b/tests/manual/qmlcamera/qml/qmlcamera/main.qml
new file mode 100644
index 00000000..7a697a16
--- /dev/null
+++ b/tests/manual/qmlcamera/qml/qmlcamera/main.qml
@@ -0,0 +1,238 @@
+/******************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Data Visualization module.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** $QT_END_LICENSE$
+**
+******************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtDataVisualization 1.2
+import "."
+
+Rectangle {
+ id: mainview
+ width: 1280
+ height: 1024
+ visible: true
+
+ Data {
+ id: chartData
+ }
+
+ Axes {
+ 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
+ height: parent.height
+ anchors.right: parent.right;
+
+ Bars3D {
+ id: testChart
+ width: dataView.width
+ height: dataView.height
+ shadowQuality: Bars3D.ShadowQualityMedium
+ selectionMode: Bars3D.SelectionItem
+ theme: Theme3D {
+ type: Theme3D.ThemeDigia
+ font.pointSize: 35
+ labelBackgroundEnabled: true
+ }
+ seriesList: [chartData.series]
+ barThickness: 0.5
+ barSpacing: Qt.size(0.5, 0.5)
+ barSpacingRelative: false
+
+ columnAxis: chartAxes.column
+ valueAxis: chartAxes.expenses
+
+ 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(2.0,29.0,2.0)
+ scaling: Qt.vector3d(0.2,0.2,0.2)
+ }
+
+ Custom3DLabel {
+ id: labelItem
+ facingCamera: true
+ positionAbsolute: true
+ position: Qt.vector3d(-1.0,1.5,-1.0)
+ scaling: Qt.vector3d(1.0,1.0,1.0)
+ text: "Qt Shuttle"
+ }
+
+ MouseArea {
+ id: inputArea
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ property bool selectionOn: false
+
+ onPressed: {
+ if (mouse.button == Qt.LeftButton) {
+ selectionOn = true;
+ testChart.scene.selectionQueryPosition = Qt.point(mouse.x, mouse.y);
+ }
+ }
+
+ onReleased: {
+ if (mouse.button == Qt.LeftButton)
+ selectionOn = false;
+ }
+
+ onPositionChanged: {
+ if (selectionOn) {
+ testChart.scene.selectionQueryPosition = Qt.point(mouse.x, mouse.y);
+ }
+ }
+ }
+ }
+
+ ControlSurface {
+ id: camControlArea
+ x: 0
+ y: 0
+ width: 298
+ height: 298
+ minXValue: -180
+ minYValue: 0
+ maxXValue: 180
+ maxYValue: 90
+ }
+
+ Slider {
+ id: zoomSlider
+ width: camControlArea.width
+ anchors.top: camControlArea.bottom
+ value: 100
+ minimumValue: 10
+ maximumValue: 300
+ }
+
+ Button {
+ id: mappingToggle
+ anchors.bottom: parent.bottom
+ width: camControlArea.width
+ text: "Show Income"
+ onClicked: {
+ if (chartData.proxy.valueRole === "expenses") {
+ chartData.proxy.valueRole = "income"
+ text = "Show Expenses"
+ testChart.valueAxis = chartAxes.income
+ } else {
+ chartData.proxy.valueRole = "expenses"
+ text = "Show Income"
+ testChart.valueAxis = chartAxes.expenses
+ }
+ }
+ }
+
+ Button {
+ id: angleAdjust
+ anchors.bottom: mappingToggle.top
+ width: camControlArea.width
+ text: "Adjust angle"
+ property real currentAngle: 0
+ onClicked: {
+ 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
+ }
+ }
+
+ Button {
+ id: dataToggle
+ anchors.bottom: angleAdjust.top
+ width: camControlArea.width
+ text: "Show 2010 - 2012"
+ onClicked: {
+ if (testChart.rowAxis.max !== 6) {
+ text = "Show 2010 - 2012"
+ chartData.proxy.autoRowCategories = true
+ } else {
+ text = "Show all years"
+ // Explicitly defining row categories, since we do not want to show data for
+ // all years in the model, just for the selected ones.
+ chartData.proxy.autoRowCategories = false
+ chartData.proxy.rowCategories = ["2010", "2011", "2012"]
+ }
+ }
+ }
+
+ Button {
+ id: shuttleAdd
+ anchors.bottom: dataToggle.top
+ width: camControlArea.width
+ text: "Remove Shuttle"
+ property bool addObject: false
+ onClicked: {
+ if (addObject === true) {
+ shuttleItem.textureFile = ":/items/shuttle.png"
+ testChart.addCustomItem(shuttleItem)
+ text = "Remove Shuttle"
+ addObject = false
+ } else {
+ testChart.releaseCustomItem(shuttleItem)
+ text = "Add Shuttle"
+ addObject = true
+ }
+ }
+ }
+
+ 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
+ }
+ }
+ }
+}