diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-05-13 12:37:06 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-05-13 12:57:45 +0300 |
commit | 576050ff96cbf67014313bd7c1f2b475b00dd80c (patch) | |
tree | 01e9f6d2abaef6e535d8433ed23821d77cac10ac /tests | |
parent | 200031404f12422b78e9220aeb4fa12ba8f358a7 (diff) |
Multi-match behavior implementation for bar item model proxy
Task-number: QTRD-3074
Change-Id: I8e34d2546198a743e0132f0ce201dd38daf7ce7a
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qmlmultitest/qml/qmlmultitest/Data.qml | 21 | ||||
-rw-r--r-- | tests/qmlmultitest/qml/qmlmultitest/main.qml | 32 |
2 files changed, 42 insertions, 11 deletions
diff --git a/tests/qmlmultitest/qml/qmlmultitest/Data.qml b/tests/qmlmultitest/qml/qmlmultitest/Data.qml index ddc0aad8..2ef168da 100644 --- a/tests/qmlmultitest/qml/qmlmultitest/Data.qml +++ b/tests/qmlmultitest/qml/qmlmultitest/Data.qml @@ -43,6 +43,27 @@ Item { ListElement{ coords: "1,4"; data: "21.3/14.6/5.83"; } ListElement{ coords: "2,4"; data: "22.5/14.8/7.32"; } ListElement{ coords: "3,4"; data: "23.7/14.3/6.90"; } + + ListElement{ coords: "0,0"; data: "40.0/30.0/14.75"; } + ListElement{ coords: "1,0"; data: "41.1/30.3/13.00"; } + ListElement{ coords: "2,0"; data: "42.5/30.7/11.24"; } + ListElement{ coords: "3,0"; data: "44.0/30.5/12.53"; } + ListElement{ coords: "0,1"; data: "40.2/31.2/13.55"; } + ListElement{ coords: "1,1"; data: "41.3/31.5/13.03"; } + ListElement{ coords: "2,1"; data: "42.6/31.7/13.46"; } + ListElement{ coords: "3,1"; data: "43.4/31.5/14.12"; } + ListElement{ coords: "0,2"; data: "40.2/32.3/13.37"; } + ListElement{ coords: "1,2"; data: "41.1/32.4/12.98"; } + ListElement{ coords: "2,2"; data: "42.5/32.1/13.33"; } + ListElement{ coords: "3,2"; data: "43.3/32.7/13.23"; } + ListElement{ coords: "0,3"; data: "40.7/33.3/15.34"; } + ListElement{ coords: "1,3"; data: "41.5/33.2/14.54"; } + ListElement{ coords: "2,3"; data: "42.4/33.6/14.65"; } + ListElement{ coords: "3,3"; data: "43.2/33.4/16.67"; } + ListElement{ coords: "0,4"; data: "40.6/35.0/16.01"; } + ListElement{ coords: "1,4"; data: "41.3/34.6/15.83"; } + ListElement{ coords: "2,4"; data: "42.5/34.8/17.32"; } + ListElement{ coords: "3,4"; data: "43.7/34.3/16.90"; } } } diff --git a/tests/qmlmultitest/qml/qmlmultitest/main.qml b/tests/qmlmultitest/qml/qmlmultitest/main.qml index 84eb4294..b5a62902 100644 --- a/tests/qmlmultitest/qml/qmlmultitest/main.qml +++ b/tests/qmlmultitest/qml/qmlmultitest/main.qml @@ -59,6 +59,7 @@ Rectangle { Surface3DSeries { itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel" ItemModelSurfaceDataProxy { + id: surfaceProxy itemModel: data.sharedData // The surface data points are not neatly lined up in rows and columns, // so we define explicit row and column roles. @@ -118,10 +119,11 @@ Rectangle { } NewButton { + id: mmbButton Layout.fillHeight: true Layout.fillWidth: true - text: "Toggle Mesh Styles" - onClicked: toggleMeshStyle() // call a helper function to keep button itself simpler + text: "MMB: Last" + onClicked: changeMMB() // call a helper function to keep button itself simpler } } } @@ -146,6 +148,7 @@ Rectangle { itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel" mesh: Abstract3DSeries.MeshCube ItemModelScatterDataProxy { + id: scatterProxy itemModel: data.sharedData // Mapping model roles to scatter series item coordinates. xPosRole: "data" @@ -187,17 +190,21 @@ Rectangle { name: "Population density" ItemModelBarDataProxy { + id: barProxy itemModel: data.sharedData // Mapping model roles to bar series rows, columns, and values. rowRole: "coords" columnRole: "coords" valueRole: "data" + rotationRole: "coords" rowRolePattern: /(\d),\d/ columnRolePattern: /(\d),(\d)/ valueRolePattern: /^([^\/]*)\/([^\/]*)\/(.*)$/ + rotationRolePattern: /(\d)\,(\d)/ rowRoleReplace: "\\1" columnRoleReplace: "\\2" valueRoleReplace: "\\3" + rotationRoleReplace: "\\2\\1" } } } @@ -219,16 +226,19 @@ Rectangle { barGraph.scene.activeCamera.zoomLevel = 100.0 } - function toggleMeshStyle() { - if (barGraph.seriesList[0].meshSmooth === true) { - barGraph.seriesList[0].meshSmooth = false - if (surfaceGraph.seriesList[0].flatShadingSupported) - surfaceGraph.seriesList[0].flatShadingEnabled = true - scatterGraph.seriesList[0].meshSmooth = false + function changeMMB() { + if (barProxy.multiMatchBehavior === ItemModelBarDataProxy.MMBLast) { + barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBAverage + mmbButton.text = "MMB: Average" + } else if (barProxy.multiMatchBehavior === ItemModelBarDataProxy.MMBAverage) { + barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBCumulative + mmbButton.text = "MMB: Cumulative" + } else if (barProxy.multiMatchBehavior === ItemModelBarDataProxy.MMBCumulative) { + barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBFirst + mmbButton.text = "MMB: First" } else { - barGraph.seriesList[0].meshSmooth = true - surfaceGraph.seriesList[0].flatShadingEnabled = false - scatterGraph.seriesList[0].meshSmooth = true + barProxy.multiMatchBehavior = ItemModelBarDataProxy.MMBLast + mmbButton.text = "MMB: Last" } } } |