summaryrefslogtreecommitdiffstats
path: root/examples/qmlbarchart
diff options
context:
space:
mode:
authorKeränen Pasi <pasi.keranen@digia.com>2013-06-12 09:55:50 +0300
committerPasi Keränen <pasi.keranen@digia.com>2013-06-12 10:07:16 +0300
commit05ac561f2a501cfc720b6b2b3cd199cff9c156b8 (patch)
treefad12e483aa2c53166b6793b0a96c4e6ef81e1eb /examples/qmlbarchart
parent78bc09779e2fa380f2f5854147bf5beba87e3fc4 (diff)
Refactoring commong 3d bars functionality to separate class, added QML classes.
Change-Id: If983093d431b578db57ee0216f4d52c169978d36 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/qmlbarchart')
-rw-r--r--examples/qmlbarchart/main.cpp2
-rw-r--r--examples/qmlbarchart/qml/qmlbarchart/main.qml134
2 files changed, 74 insertions, 62 deletions
diff --git a/examples/qmlbarchart/main.cpp b/examples/qmlbarchart/main.cpp
index 37fd461e..d813443e 100644
--- a/examples/qmlbarchart/main.cpp
+++ b/examples/qmlbarchart/main.cpp
@@ -20,10 +20,12 @@
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
+#include <QDebug>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
+ qDebug() << "Hello world.";
QtQuick2ApplicationViewer viewer;
#ifdef Q_OS_ANDROID
diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml
index 3289c792..990c78e6 100644
--- a/examples/qmlbarchart/qml/qmlbarchart/main.qml
+++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml
@@ -23,24 +23,16 @@ import QtQuick.Window 2.1
import com.digia.QtDataVis3D 1.0
Item {
- id: container
- //anchors.fill: parent
- width: 800
- height: 500
+ id: mainview
+ //title: "My MainWindow"
+ width: 640
+ height: 480
+ visible: true
- DataVisView {
- id: mainview
- anchors.fill: parent
- antialiasing: true
- // This allows us to flip the texture to be displayed correctly in scene graph
- // TODO: Find a way to do it in code..
- transform: [
- Rotation {
- id: rotation;
- axis.x: 1; axis.z: 0; axis.y: 0; angle: 0;
- origin.x: width / 2; origin.y: height / 2;
- }
- ]
+ Bars3D {
+ id: testchart
+ width: mainview.width
+ height: mainview.height
DataItem {
id: testitem
@@ -52,60 +44,78 @@ Item {
label: "Test2"
value: -10
}
+ DataItem {
+ id: testitem3
+ label: "Test3"
+ value: 5
+ }
+
+ DataItem {
+ id: testitem4
+ label: "Test4"
+ value: -7
+ }
+ DataItem {
+ id: testitem5
+ label: "Test5"
+ value: 8
+ }
+ DataItem {
+ id: testitem6
+ label: "Test6"
+ value: 1
+ }
+
DataRow {
- id: testrow
+ id: testrow1
function addData() {
- testrow.addItem(testitem);
- testrow.addItem(testitem2);
+ testrow1.addItem(testitem);
+ testrow1.addItem(testitem2);
+ testrow1.addItem(testitem3);
+ testrow1.addItem(testitem4);
+ testrow1.addItem(testitem5);
+ testrow1.addItem(testitem6);
}
}
-// Bars {
-// id: testchart
-// visible: true
-// width: mainview.width
-// height: mainview.height
-// //x: mainview.x + mainview.width
-// //y: mainview.y
-// grid: false
-// shadowQuality: Bars.ShadowNone
-// selectionMode: Bars.ModeNone
-// labelTransparency: Bars.TransparencyNone
-// windowTitle: "QmlTest3DBars"
+ //visible: true
+ //x: mainview.x + mainview.width
+ //y: mainview.y
-// function setUpBars() {
-// /*console.log(parent)
-// console.log(container.x)
-// console.log(container.y)
-// console.log(Window.x)
-// console.log(Window.y)
-// console.log(Screen.desktopAvailableHeight)
-// console.log(Screen.desktopAvailableWidth)
-// console.log(mainview.x)
-// console.log(mainview.y)
-// console.log(x)
-// console.log(y)*/
-// testchart.setupSampleSpace(2, 1);
-// testchart.addDataRow(testrow);
-// }
-// }
+ grid: false
+ shadowQuality: Bars3D.ShadowNone
+ selectionMode: Bars3D.ModeNone
+ labelTransparency: Bars3D.TransparencyNone
- MouseArea {
- anchors.fill: parent
- onClicked: {
-// testchart.destroy();
-// testchart.close();
- Qt.quit();
- }
+ function setUpBars3D() {
+ /*console.log(parent)
+ console.log(container.x)
+ console.log(container.y)
+ console.log(Window.x)
+ console.log(Window.y)
+ console.log(Screen.desktopAvailableHeight)
+ console.log(Screen.desktopAvailableWidth)
+ console.log(mainview.x)
+ console.log(mainview.y)
+ console.log(x)
+ console.log(y)*/
+ testchart.setupSampleSpace(6, 1);
+ testchart.addDataRow(testrow1);
}
+ }
- Component.onCompleted: {
- // This allows us to flip the texture to be displayed correctly in scene graph
- // TODO: Find a way to do it in code..
- rotation.angle = 180
- console.log("kukkuu")
-// testrow.addData();
-// testchart.setUpBars();
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ Qt.quit();
}
}
+
+ Component.onCompleted: {
+ // This allows us to flip the texture to be displayed correctly in scene graph
+ // TODO: Find a way to do it in code..
+ //rotation.angle = 180
+ testrow1.addData();
+ testchart.setUpBars3D();
+ }
}