summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKeränen Pasi <pasi.keranen@digia.com>2013-09-27 09:05:53 +0300
committerPasi Keränen <pasi.keranen@digia.com>2013-10-08 10:50:41 +0300
commit66e1b09592efe77f839a0878ec6165a02408ca6f (patch)
tree709736fc6693c014abc0467a7c1ac766c1c62c4f /tests
parent0daa4359bdaba6372bc8235550892afdef003120 (diff)
Added Camera QML API and Example
Change-Id: Ibc790ac6c720b6d22d68f662ff2f50e74a9abaae Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/barstest/chart.cpp8
-rw-r--r--tests/qmlcamera/main.cpp40
-rw-r--r--tests/qmlcamera/qml/qmlcamera/Axes.qml50
-rw-r--r--tests/qmlcamera/qml/qmlcamera/ControlSurface.qml53
-rw-r--r--tests/qmlcamera/qml/qmlcamera/Data.qml133
-rw-r--r--tests/qmlcamera/qml/qmlcamera/main.qml150
-rw-r--r--tests/qmlcamera/qmlcamera.desktop11
-rw-r--r--tests/qmlcamera/qmlcamera.pro31
-rw-r--r--tests/qmlcamera/qmlcamera.qrc7
-rw-r--r--tests/qmlcamera/qmlcamera64.pngbin0 -> 3400 bytes
-rw-r--r--tests/qmlcamera/qmlcamera80.pngbin0 -> 4945 bytes
-rw-r--r--tests/qmlcamera/qmlcamera_harmattan.desktop11
-rw-r--r--tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp81
-rw-r--r--tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri180
-rw-r--r--tests/scattertest/scatterchart.cpp6
-rw-r--r--tests/spectrum/spectrumapp/main.cpp4
-rw-r--r--tests/tests.pro3
18 files changed, 794 insertions, 7 deletions
diff --git a/tests/barstest/chart.cpp b/tests/barstest/chart.cpp
index c1599b18..ad27d83c 100644
--- a/tests/barstest/chart.cpp
+++ b/tests/barstest/chart.cpp
@@ -20,6 +20,8 @@
#include <QtDataVisualization/q3dcategoryaxis.h>
#include <QtDataVisualization/q3dvalueaxis.h>
#include <QtDataVisualization/qbardataproxy.h>
+#include <QtDataVisualization/q3dscene.h>
+#include <QtDataVisualization/q3dcamera.h>
#include <QTime>
QT_DATAVISUALIZATION_USE_NAMESPACE
@@ -445,7 +447,7 @@ void GraphModifier::changePresetCamera()
{
static int preset = QDataVis::CameraPresetFrontLow;
- m_chart->setCameraPreset((QDataVis::CameraPreset)preset);
+ m_chart->scene()->activeCamera()->setCameraPreset((QDataVis::CameraPreset)preset);
if (++preset > QDataVis::CameraPresetDirectlyBelow)
preset = QDataVis::CameraPresetFrontLow;
@@ -529,13 +531,13 @@ void GraphModifier::setGridEnabled(int enabled)
void GraphModifier::rotateX(int rotation)
{
m_xRotation = rotation;
- m_chart->setCameraPosition(m_xRotation, m_yRotation);
+ m_chart->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation);
}
void GraphModifier::rotateY(int rotation)
{
m_yRotation = rotation;
- m_chart->setCameraPosition(m_xRotation, m_yRotation);
+ m_chart->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation);
}
void GraphModifier::setSpecsRatio(int barwidth)
diff --git a/tests/qmlcamera/main.cpp b/tests/qmlcamera/main.cpp
new file mode 100644
index 00000000..90d81eab
--- /dev/null
+++ b/tests/qmlcamera/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+#ifdef Q_OS_ANDROID
+ viewer.addImportPath(QString::fromLatin1("assets:/qml"));
+ viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
+ QString::fromLatin1("lib")));
+#else
+ viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+#endif
+ viewer.setMainQmlFile(QStringLiteral("qml/qmlcamera/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/tests/qmlcamera/qml/qmlcamera/Axes.qml b/tests/qmlcamera/qml/qmlcamera/Axes.qml
new file mode 100644
index 00000000..b0ba3eb2
--- /dev/null
+++ b/tests/qmlcamera/qml/qmlcamera/Axes.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import com.digia.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
+ categoryLabels: ["January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"]
+ }
+ ValueAxis3D {
+ id: incomeAxis
+ min: 0
+ max: 35
+ labelFormat: "%.2f M\u20AC"
+ title: "Monthly income"
+ }
+ ValueAxis3D {
+ id: expensesAxis
+ min: 0
+ max: 35
+ labelFormat: "-%.2f M\u20AC"
+ title: "Monthly expenses"
+ }
+}
diff --git a/tests/qmlcamera/qml/qmlcamera/ControlSurface.qml b/tests/qmlcamera/qml/qmlcamera/ControlSurface.qml
new file mode 100644
index 00000000..c655e016
--- /dev/null
+++ b/tests/qmlcamera/qml/qmlcamera/ControlSurface.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+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/qmlcamera/qml/qmlcamera/Data.qml b/tests/qmlcamera/qml/qmlcamera/Data.qml
new file mode 100644
index 00000000..fff568cc
--- /dev/null
+++ b/tests/qmlcamera/qml/qmlcamera/Data.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import com.digia.QtDataVisualization 1.0
+
+Item {
+ property alias mapping: valueMapping
+ property alias model: dataModel
+ property alias proxy: modelProxy
+
+ BarDataMapping {
+ id: valueMapping
+ rowRole: "year"
+ columnRole: "month"
+ valueRole: "expenses"
+ }
+
+ ItemModelBarDataProxy {
+ id: modelProxy
+ activeMapping: valueMapping
+ itemModel: dataModel
+ }
+
+ ListModel {
+ id: dataModel
+ ListElement{ year: "2006"; month: "Jan"; expenses: "4"; income: "5" }
+ ListElement{ year: "2006"; month: "Feb"; expenses: "5"; income: "6" }
+ ListElement{ year: "2006"; month: "Mar"; expenses: "7"; income: "4" }
+ ListElement{ year: "2006"; month: "Apr"; expenses: "3"; income: "2" }
+ ListElement{ year: "2006"; month: "May"; expenses: "4"; income: "1" }
+ ListElement{ year: "2006"; month: "Jun"; expenses: "2"; income: "2" }
+ ListElement{ year: "2006"; month: "Jul"; expenses: "1"; income: "3" }
+ ListElement{ year: "2006"; month: "Aug"; expenses: "5"; income: "1" }
+ ListElement{ year: "2006"; month: "Sep"; expenses: "2"; income: "3" }
+ ListElement{ year: "2006"; month: "Oct"; expenses: "5"; income: "2" }
+ ListElement{ year: "2006"; month: "Nov"; expenses: "8"; income: "5" }
+ ListElement{ year: "2006"; month: "Dec"; expenses: "3"; income: "3" }
+
+ ListElement{ year: "2007"; month: "Jan"; expenses: "3"; income: "1" }
+ ListElement{ year: "2007"; month: "Feb"; expenses: "4"; income: "2" }
+ ListElement{ year: "2007"; month: "Mar"; expenses: "12"; income: "4" }
+ ListElement{ year: "2007"; month: "Apr"; expenses: "13"; income: "6" }
+ ListElement{ year: "2007"; month: "May"; expenses: "14"; income: "11" }
+ ListElement{ year: "2007"; month: "Jun"; expenses: "7"; income: "7" }
+ ListElement{ year: "2007"; month: "Jul"; expenses: "6"; income: "4" }
+ ListElement{ year: "2007"; month: "Aug"; expenses: "4"; income: "15" }
+ ListElement{ year: "2007"; month: "Sep"; expenses: "2"; income: "18" }
+ ListElement{ year: "2007"; month: "Oct"; expenses: "29"; income: "25" }
+ ListElement{ year: "2007"; month: "Nov"; expenses: "23"; income: "29" }
+ ListElement{ year: "2007"; month: "Dec"; expenses: "5"; 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: "4"; income: "5" }
+ ListElement{ year: "2009"; month: "Feb"; expenses: "4"; income: "7" }
+ ListElement{ year: "2009"; month: "Mar"; expenses: "11"; income: "14" }
+ ListElement{ year: "2009"; month: "Apr"; expenses: "16"; income: "22" }
+ ListElement{ year: "2009"; month: "May"; expenses: "3"; income: "5" }
+ ListElement{ year: "2009"; month: "Jun"; expenses: "4"; income: "8" }
+ ListElement{ year: "2009"; month: "Jul"; expenses: "7"; income: "9" }
+ ListElement{ year: "2009"; month: "Aug"; expenses: "9"; income: "13" }
+ ListElement{ year: "2009"; month: "Sep"; expenses: "1"; income: "6" }
+ ListElement{ year: "2009"; month: "Oct"; expenses: "14"; income: "25" }
+ ListElement{ year: "2009"; month: "Nov"; expenses: "19"; income: "29" }
+ ListElement{ year: "2009"; month: "Dec"; expenses: "5"; income: "7" }
+
+ ListElement{ year: "2010"; month: "Jan"; expenses: "14"; income: "22" }
+ ListElement{ year: "2010"; month: "Feb"; expenses: "5"; income: "7" }
+ ListElement{ year: "2010"; month: "Mar"; expenses: "1"; income: "9" }
+ ListElement{ year: "2010"; month: "Apr"; expenses: "1"; income: "12" }
+ ListElement{ year: "2010"; month: "May"; expenses: "5"; income: "9" }
+ ListElement{ year: "2010"; month: "Jun"; expenses: "5"; income: "8" }
+ ListElement{ year: "2010"; month: "Jul"; expenses: "3"; income: "7" }
+ ListElement{ year: "2010"; month: "Aug"; expenses: "1"; income: "5" }
+ ListElement{ year: "2010"; month: "Sep"; expenses: "2"; income: "4" }
+ ListElement{ year: "2010"; month: "Oct"; expenses: "10"; income: "13" }
+ ListElement{ year: "2010"; month: "Nov"; expenses: "12"; income: "17" }
+ ListElement{ year: "2010"; month: "Dec"; expenses: "6"; income: "9" }
+
+ ListElement{ year: "2011"; month: "Jan"; expenses: "2"; income: "6" }
+ ListElement{ year: "2011"; month: "Feb"; expenses: "4"; income: "8" }
+ ListElement{ year: "2011"; month: "Mar"; expenses: "7"; income: "12" }
+ ListElement{ year: "2011"; month: "Apr"; expenses: "9"; income: "15" }
+ ListElement{ year: "2011"; month: "May"; expenses: "7"; income: "19" }
+ ListElement{ year: "2011"; month: "Jun"; expenses: "9"; income: "18" }
+ ListElement{ year: "2011"; month: "Jul"; expenses: "13"; income: "17" }
+ ListElement{ year: "2011"; month: "Aug"; expenses: "5"; income: "9" }
+ ListElement{ year: "2011"; month: "Sep"; expenses: "3"; income: "8" }
+ ListElement{ year: "2011"; month: "Oct"; expenses: "13"; income: "15" }
+ ListElement{ year: "2011"; month: "Nov"; expenses: "8"; income: "17" }
+ ListElement{ year: "2011"; month: "Dec"; expenses: "7"; income: "10" }
+
+ ListElement{ year: "2012"; month: "Jan"; expenses: "12"; income: "16" }
+ ListElement{ year: "2012"; month: "Feb"; expenses: "24"; income: "28" }
+ ListElement{ year: "2012"; month: "Mar"; expenses: "27"; income: "22" }
+ ListElement{ year: "2012"; month: "Apr"; expenses: "29"; income: "25" }
+ ListElement{ year: "2012"; month: "May"; expenses: "27"; income: "29" }
+ ListElement{ year: "2012"; month: "Jun"; expenses: "19"; income: "18" }
+ ListElement{ year: "2012"; month: "Jul"; expenses: "13"; income: "17" }
+ ListElement{ year: "2012"; month: "Aug"; expenses: "15"; income: "19" }
+ ListElement{ year: "2012"; month: "Sep"; expenses: "3"; income: "8" }
+ ListElement{ year: "2012"; month: "Oct"; expenses: "3"; income: "6" }
+ ListElement{ year: "2012"; month: "Nov"; expenses: "4"; income: "8" }
+ ListElement{ year: "2012"; month: "Dec"; expenses: "5"; income: "9" }
+ }
+}
diff --git a/tests/qmlcamera/qml/qmlcamera/main.qml b/tests/qmlcamera/qml/qmlcamera/main.qml
new file mode 100644
index 00000000..0518c1c8
--- /dev/null
+++ b/tests/qmlcamera/qml/qmlcamera/main.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import com.digia.QtDataVisualization 1.0
+import "."
+
+Item {
+ id: mainview
+ width: 1280
+ height: 1024
+ visible: true
+
+ Data {
+ id: chartData
+ }
+
+ Axes {
+ id: chartAxes
+ }
+
+ 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.SelectionModeItem
+ font.pointSize: 35
+ theme: Bars3D.ThemeRetro
+ labelStyle: Bars3D.LabelStyleFromTheme
+ dataProxy: chartData.proxy
+ barThickness: 0.5
+ barSpacing: Qt.size(0.5, 0.5)
+ barSpacingRelative: false
+
+ columnAxis: chartAxes.column
+ valueAxis: chartAxes.expenses
+ itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel"
+
+ onSelectedBarPosChanged: {
+ // Set camControlArea current row to selected bar
+ var rowRole = chartData.proxy.rowLabels[position.x];
+ var colRole = chartData.proxy.columnLabels[position.y];
+ }
+
+ // 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
+ inputHandler: null
+ }
+ }
+
+ ControlSurface {
+ id: camControlArea
+ x: 0
+ y: 0
+ width: 298
+ height: 298
+ minXValue: testChart.scene.activeCamera.minXRotation
+ minYValue: testChart.scene.activeCamera.minYRotation
+ maxXValue: testChart.scene.activeCamera.maxYRotation
+ maxYValue: testChart.scene.activeCamera.maxYRotation
+ }
+
+ 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.mapping.valueRole === "expenses") {
+ chartData.mapping.valueRole = "income"
+ text = "Show Expenses"
+ testChart.valueAxis = chartAxes.income
+ } else {
+ chartData.mapping.valueRole = "expenses"
+ text = "Show Income"
+ testChart.valueAxis = chartAxes.expenses
+ }
+ }
+ }
+
+ Button {
+ id: shadowToggle
+ anchors.bottom: mappingToggle.top
+ width: camControlArea.width
+ text: "Hide Shadows"
+ onClicked: {
+ if (testChart.shadowQuality == Bars3D.ShadowQualityNone) {
+ testChart.shadowQuality = Bars3D.ShadowQualityMedium;
+ text = "Hide Shadows"
+ } else {
+ testChart.shadowQuality = Bars3D.ShadowQualityNone;
+ text = "Show Shadows"
+ }
+ }
+ }
+
+ Button {
+ id: dataToggle
+ anchors.bottom: shadowToggle.top
+ width: camControlArea.width
+ text: "Show 2010 - 2012"
+ onClicked: {
+ if (testChart.rowAxis.max !== 6) {
+ text = "Show 2010 - 2012"
+ chartData.mapping.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.mapping.autoRowCategories = false
+ chartData.mapping.rowCategories = ["2010", "2011", "2012"]
+ }
+ }
+ }
+}
diff --git a/tests/qmlcamera/qmlcamera.desktop b/tests/qmlcamera/qmlcamera.desktop
new file mode 100644
index 00000000..10a0a2e7
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=qmlcamera
+Exec=/opt/qmlcamera/bin/qmlcamera
+Icon=qmlcamera64
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/tests/qmlcamera/qmlcamera.pro b/tests/qmlcamera/qmlcamera.pro
new file mode 100644
index 00000000..bc3a6953
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera.pro
@@ -0,0 +1,31 @@
+# Add more folders to ship with the application, here
+folder_01.source = qml/qmlcamera
+folder_01.target = qml
+DEPLOYMENTFOLDERS = folder_01
+
+# Additional import path used to resolve QML modules in Creator's code model
+QML_IMPORT_PATH =
+
+# If your application uses the Qt Mobility libraries, uncomment the following
+# lines and add the respective components to the MOBILITY variable.
+# CONFIG += mobility
+# MOBILITY +=
+
+# The .cpp file which was generated for your project. Feel free to hack it.
+SOURCES += main.cpp
+
+# Installation path
+# target.path =
+
+# Please do not modify the following two lines. Required for deployment.
+include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
+qtcAddDeployment()
+
+RESOURCES += \
+ qmlcamera.qrc
+
+OTHER_FILES += \
+ qml/qmlcamera/Data.qml \
+ qml/qmlcamera/Axes.qml \
+ qml/qmlcamera/main.qml \
+ qml/qmlcamera/ControlSurface.qml
diff --git a/tests/qmlcamera/qmlcamera.qrc b/tests/qmlcamera/qmlcamera.qrc
new file mode 100644
index 00000000..d9b993c7
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/qml">
+ <file alias="main.qml">qml/qmlcamera/main.qml</file>
+ <file alias="Data.qml">qml/qmlcamera/Data.qml</file>
+ <file alias="Axes.qml">qml/qmlcamera/Axes.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/qmlcamera/qmlcamera64.png b/tests/qmlcamera/qmlcamera64.png
new file mode 100644
index 00000000..707d5c4e
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera64.png
Binary files differ
diff --git a/tests/qmlcamera/qmlcamera80.png b/tests/qmlcamera/qmlcamera80.png
new file mode 100644
index 00000000..6ad8096c
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera80.png
Binary files differ
diff --git a/tests/qmlcamera/qmlcamera_harmattan.desktop b/tests/qmlcamera/qmlcamera_harmattan.desktop
new file mode 100644
index 00000000..8e9e9857
--- /dev/null
+++ b/tests/qmlcamera/qmlcamera_harmattan.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=qmlcamera
+Exec=/usr/bin/single-instance /opt/qmlcamera/bin/qmlcamera
+Icon=/usr/share/icons/hicolor/80x80/apps/qmlcamera80.png
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp
new file mode 100644
index 00000000..10709d7a
--- /dev/null
+++ b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp
@@ -0,0 +1,81 @@
+// checksum 0x4f6f version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#include "qtquick2applicationviewer.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+class QtQuick2ApplicationViewerPrivate
+{
+ QString mainQmlFile;
+ friend class QtQuick2ApplicationViewer;
+ static QString adjustPath(const QString &path);
+};
+
+QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
+{
+#if defined(Q_OS_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_BLACKBERRY)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("app/native/%1").arg(path);
+#elif !defined(Q_OS_ANDROID)
+ QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+ pathInInstallDir =
+ QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
+ : QQuickView(parent)
+ , d(new QtQuick2ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QQuickView::SizeRootObjectToView);
+}
+
+QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+#ifdef Q_OS_ANDROID
+ setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
+#else
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+#endif
+}
+
+void QtQuick2ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h
new file mode 100644
index 00000000..cf66f140
--- /dev/null
+++ b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h
@@ -0,0 +1,33 @@
+// checksum 0xfde6 version 0x90005
+/*
+ This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+ QtQuick2ApplicationViewer is a convenience class containing mobile device specific
+ code such as screen orientation handling. Also QML paths and debugging are
+ handled here.
+ It is recommended not to modify this file, since newer versions of Qt Creator
+ may offer an updated version of it.
+*/
+
+#ifndef QTQUICK2APPLICATIONVIEWER_H
+#define QTQUICK2APPLICATIONVIEWER_H
+
+#include <QtQuick/QQuickView>
+
+class QtQuick2ApplicationViewer : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
+ virtual ~QtQuick2ApplicationViewer();
+
+ void setMainQmlFile(const QString &file);
+ void addImportPath(const QString &path);
+
+ void showExpanded();
+
+private:
+ class QtQuick2ApplicationViewerPrivate *d;
+};
+
+#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri
new file mode 100644
index 00000000..e5f7990f
--- /dev/null
+++ b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri
@@ -0,0 +1,180 @@
+# checksum 0x7b0d version 0x90005
+# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
+# The code below adds the QtQuick2ApplicationViewer to the project and handles
+# the activation of QML debugging.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+QT += qml quick
+
+SOURCES += $$PWD/qtquick2applicationviewer.cpp
+HEADERS += $$PWD/qtquick2applicationviewer.h
+INCLUDEPATH += $$PWD
+# This file was generated by an application wizard of Qt Creator.
+# The code below handles deployment to Android and Maemo, aswell as copying
+# of the application data to shadow build directories on desktop.
+# It is recommended not to modify this file, since newer versions of Qt Creator
+# may offer an updated version of it.
+
+defineTest(qtcAddDeployment) {
+for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ greaterThan(QT_MAJOR_VERSION, 4) {
+ itemsources = $${item}.files
+ } else {
+ itemsources = $${item}.sources
+ }
+ $$itemsources = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath= $$eval($${deploymentfolder}.target)
+ export($$itemsources)
+ export($$itempath)
+ DEPLOYMENT += $$item
+}
+
+MAINPROFILEPWD = $$PWD
+
+android-no-sdk {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ target.path = /data/user/qt
+
+ export(target.path)
+ INSTALLS += target
+} else:android {
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = /assets/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ x86 {
+ target.path = /libs/x86
+ } else: armeabi-v7a {
+ target.path = /libs/armeabi-v7a
+ } else {
+ target.path = /libs/armeabi
+ }
+
+ export(target.path)
+ INSTALLS += target
+} else:win32 {
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, /, \\)
+ sourcePathSegments = $$split(source, \\)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
+ target = $$replace(target, /, \\)
+ target ~= s,\\\\\\.?\\\\,\\,
+ !isEqual(source,$$target) {
+ !isEmpty(copyCommand):copyCommand += &&
+ isEqual(QMAKE_DIR_SEP, \\) {
+ copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
+ } else {
+ source = $$replace(source, \\\\, /)
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ target = $$replace(target, \\\\, /)
+ copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
+ }
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+} else:unix {
+ maemo5 {
+ desktopfile.files = $${TARGET}.desktop
+ desktopfile.path = /usr/share/applications/hildon
+ icon.files = $${TARGET}64.png
+ icon.path = /usr/share/icons/hicolor/64x64/apps
+ } else:!isEmpty(MEEGO_VERSION_MAJOR) {
+ desktopfile.files = $${TARGET}_harmattan.desktop
+ desktopfile.path = /usr/share/applications
+ icon.files = $${TARGET}80.png
+ icon.path = /usr/share/icons/hicolor/80x80/apps
+ } else { # Assumed to be a Desktop Unix
+ copyCommand =
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
+ source = $$replace(source, \\\\, /)
+ macx {
+ target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+ } else {
+ target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
+ }
+ target = $$replace(target, \\\\, /)
+ sourcePathSegments = $$split(source, /)
+ targetFullPath = $$target/$$last(sourcePathSegments)
+ targetFullPath ~= s,/\\.?/,/,
+ !isEqual(source,$$targetFullPath) {
+ !isEmpty(copyCommand):copyCommand += &&
+ copyCommand += $(MKDIR) \"$$target\"
+ copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
+ }
+ }
+ !isEmpty(copyCommand) {
+ copyCommand = @echo Copying application data... && $$copyCommand
+ copydeploymentfolders.commands = $$copyCommand
+ first.depends = $(first) copydeploymentfolders
+ export(first.depends)
+ export(copydeploymentfolders.commands)
+ QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+ }
+ }
+ !isEmpty(target.path) {
+ installPrefix = $${target.path}
+ } else {
+ installPrefix = /opt/$${TARGET}
+ }
+ for(deploymentfolder, DEPLOYMENTFOLDERS) {
+ item = item$${deploymentfolder}
+ itemfiles = $${item}.files
+ $$itemfiles = $$eval($${deploymentfolder}.source)
+ itempath = $${item}.path
+ $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
+ export($$itemfiles)
+ export($$itempath)
+ INSTALLS += $$item
+ }
+
+ !isEmpty(desktopfile.path) {
+ export(icon.files)
+ export(icon.path)
+ export(desktopfile.files)
+ export(desktopfile.path)
+ INSTALLS += icon desktopfile
+ }
+
+ isEmpty(target.path) {
+ target.path = $${installPrefix}/bin
+ export(target.path)
+ }
+ INSTALLS += target
+}
+
+export (ICON)
+export (INSTALLS)
+export (DEPLOYMENT)
+export (LIBS)
+export (QMAKE_EXTRA_TARGETS)
+}
diff --git a/tests/scattertest/scatterchart.cpp b/tests/scattertest/scatterchart.cpp
index a10f0065..f23ee99d 100644
--- a/tests/scattertest/scatterchart.cpp
+++ b/tests/scattertest/scatterchart.cpp
@@ -19,6 +19,8 @@
#include "scatterchart.h"
#include <QtDataVisualization/qscatterdataproxy.h>
#include <QtDataVisualization/q3dvalueaxis.h>
+#include <QtDataVisualization/q3dscene.h>
+#include <QtDataVisualization/q3dcamera.h>
#include <qmath.h>
using namespace QtDataVisualization;
@@ -37,7 +39,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
m_chart->setObjectType(QDataVis::MeshStyleSpheres, true);
m_chart->setTheme(QDataVis::ThemeStoneMoss);
m_chart->setShadowQuality(QDataVis::ShadowQualityHigh);
- m_chart->setCameraPreset(QDataVis::CameraPresetFront);
+ m_chart->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetFront);
m_chart->setAxisX(new Q3DValueAxis);
m_chart->setAxisY(new Q3DValueAxis);
m_chart->setAxisZ(new Q3DValueAxis);
@@ -117,7 +119,7 @@ void ScatterDataModifier::changePresetCamera()
{
static int preset = QDataVis::CameraPresetFrontLow;
- m_chart->setCameraPreset((QDataVis::CameraPreset)preset);
+ m_chart->scene()->activeCamera()->setCameraPreset((QDataVis::CameraPreset)preset);
if (++preset > QDataVis::CameraPresetDirectlyAboveCCW45)
preset = QDataVis::CameraPresetFrontLow;
diff --git a/tests/spectrum/spectrumapp/main.cpp b/tests/spectrum/spectrumapp/main.cpp
index d0282ca0..3d2e2bf1 100644
--- a/tests/spectrum/spectrumapp/main.cpp
+++ b/tests/spectrum/spectrumapp/main.cpp
@@ -23,6 +23,8 @@
#include <QtDataVisualization/qbardataproxy.h>
#include <QtDataVisualization/q3dvalueaxis.h>
#include <QtDataVisualization/q3dcategoryaxis.h>
+#include <QtDataVisualization/q3dscene.h>
+#include <QtDataVisualization/q3dcamera.h>
#include <QGuiApplication>
#include <QAudio>
@@ -92,7 +94,7 @@ MainApp::MainApp(Q3DBars *window)
// Set bar type, flat bars
m_chart->setBarType(QDataVis::MeshStyleBars, false);
// Adjust camera position
- m_chart->setCameraPosition(10.0f, 7.5f, 75);
+ m_chart->scene()->activeCamera()->setCameraPosition(10.0f, 7.5f, 75);
#endif
// Set color scheme
m_chart->setBarColor(QColor(Qt::red), false);
diff --git a/tests/tests.pro b/tests/tests.pro
index a9462378..30223e61 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -10,6 +10,7 @@ TEMPLATE = subdirs
SUBDIRS += barstest \
scattertest \
kinectsurface \
- surfacetest
+ surfacetest \
+ qmlcamera
qtHaveModule(multimedia):!android: SUBDIRS += spectrum