diff options
author | Keränen Pasi <pasi.keranen@digia.com> | 2013-06-17 15:25:00 +0300 |
---|---|---|
committer | Pasi Keränen <pasi.keranen@digia.com> | 2013-06-18 09:44:15 +0300 |
commit | b3a2f01dcad3344a112744c2060d42152e3e2d45 (patch) | |
tree | 2ddfb15f491dfa1f102b750110a9c85f4d286a8b /examples/qmlbarchart/qml | |
parent | 2e4b2b61b6104a74a82b6dffd580f342247a0ac3 (diff) |
Implemented passing of mouse events from QtQuick.
Change-Id: I5174c9deb43604924f8a63e217b851897ac2dcd6
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/qmlbarchart/qml')
-rw-r--r-- | examples/qmlbarchart/qml/qmlbarchart/main.qml | 171 |
1 files changed, 95 insertions, 76 deletions
diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml index a6517bc0..33297269 100644 --- a/examples/qmlbarchart/qml/qmlbarchart/main.qml +++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml @@ -30,95 +30,114 @@ Item { height: 480 visible: true - DataItem { - id: testitem1 - label: "Test" - value: 10 - } - DataItem { - id: testitem2 - 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: testrow1 - function addData() { - testrow1.addItem(testitem1); - testrow1.addItem(testitem2); - testrow1.addItem(testitem3); - testrow1.addItem(testitem4); - testrow1.addItem(testitem5); - testrow1.addItem(testitem6); + Item { + id: dataView + width: 480 + height: 480 + anchors.right: parent.right; + DataItem { + id: testitem1 + label: "Test" + value: 10 + } + DataItem { + id: testitem2 + 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 } - } - ListModel { - id: testdata1 - ListElement{ column1: "test" ; column2: "test" ; column3: "test" } - ListElement{ column1: "test" ; column2: "test" ; column3: "test" } -// ListElement{ column1: testitem1 ; column2: testitem2 ; column3: testitem3 } -// ListElement{ column1: testitem4 ; column2: testitem6 ; column3: testitem6 } - } + DataRow { + id: testrow1 + } - Bars3D { - id: testchart - width: mainview.width - height: mainview.height + // ListModel { + // id: testdata1 + // ListElement{ column1: "test" ; column2: "test" ; column3: "test" } + // ListElement{ column1: "test" ; column2: "test" ; column3: "test" } + // ListElement{ column1: testitem1 ; column2: testitem2 ; column3: testitem3 } + // ListElement{ column1: testitem4 ; column2: testitem6 ; column3: testitem6 } + // } - Component.onCompleted: { - data = testdata1 - } + Bars3D { + id: testchart + width: mainview.width + height: mainview.height - gridVisible: true - shadowQuality: Bars3D.ShadowNone - selectionMode: Bars3D.ModeNone - labelTransparency: Bars3D.TransparencyNone + // Component.onCompleted: { + // data = testdata1 + // } - function setUpBars3D() { - //testchart.setupSampleSpace(6, 1); - //testchart.addDataRow(testrow1); + gridVisible: true + shadowQuality: Bars3D.ShadowNone + selectionMode: Bars3D.ModeNone + labelTransparency: Bars3D.TransparencyNone } } - MouseArea { - anchors.fill: parent - onClicked: { - if (testchart.shadowQuality == Bars3D.ShadowNone) { - testchart.shadowQuality = Bars3D.ShadowLow; - } - else { - testchart.shadowQuality = Bars3D.ShadowNone; - } - //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(); + testrow1.addItem(testitem1); + testrow1.addItem(testitem2); + testrow1.addItem(testitem3); + testrow1.addItem(testitem4); + testrow1.addItem(testitem5); + testrow1.addItem(testitem6); + + testchart.setupSampleSpace(6, 1); + testchart.addDataRow(testrow1); + } + + Rectangle { + id: shadowToggle + color: "#FFFFFF" + x: 0 + y: 0 + width: 160 + height: 80 + + TextArea { + id: buttonText + text: "Toggle Shadows" + anchors.fill: parent + textColor: "#000000" + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testchart.shadowQuality == Bars3D.ShadowNone) { + testchart.shadowQuality = Bars3D.ShadowLow; + buttonText.textColor = "#FFFFFF"; + shadowToggle.color = "#000000"; + } else { + testchart.shadowQuality = Bars3D.ShadowNone; + buttonText.textColor = "#000000"; + shadowToggle.color = "#FFFFFF"; + } + } + } } } |