From b2e4f1485df801a9e7f3812a66e4e7fc6c578980 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 3 Mar 2014 13:49:27 +0200 Subject: Enable querying shadow support from graphs Also some example tweaking. Change-Id: If69e9d3617afc37b88fed4fd0e02ae19f0af7f78 Reviewed-by: Mika Salmela --- .../datavisualization/qmlbars/qml/qmlbars/main.qml | 3 ++- .../qmlcustominput/qml/qmlcustominput/main.qml | 3 ++- .../qmllegend/qml/qmllegend/main.qml | 21 ++++++++++++--------- .../qmloscilloscope/qml/qmloscilloscope/main.qml | 2 +- .../qmlscatter/qml/qmlscatter/main.qml | 3 ++- .../qmlsurface/qml/qmlsurface/main.qml | 7 +------ .../qmlsurfacelayers/qml/qmlsurfacelayers/main.qml | 3 ++- 7 files changed, 22 insertions(+), 20 deletions(-) (limited to 'examples') diff --git a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml index 3711a504..0df8d8ae 100644 --- a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml +++ b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml @@ -210,8 +210,9 @@ Rectangle { id: shadowToggle Layout.fillWidth: true Layout.fillHeight: true - text: "Hide Shadows" + text: barGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" clip: true + enabled: barGraph.shadowsSupported onClicked: { if (barGraph.shadowQuality == AbstractGraph3D.ShadowQualityNone) { barGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium; diff --git a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml index e81dd749..bdabb420 100644 --- a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml +++ b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml @@ -190,7 +190,8 @@ Rectangle { id: shadowToggle Layout.fillHeight: true Layout.minimumWidth: parent.width / 3 // 3 buttons divided equally in the layout - text: "Hide Shadows" + text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" + enabled: scatterGraph.shadowsSupported onClicked: { if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { diff --git a/examples/datavisualization/qmllegend/qml/qmllegend/main.qml b/examples/datavisualization/qmllegend/qml/qmllegend/main.qml index 6999a67b..f7e2d803 100644 --- a/examples/datavisualization/qmllegend/qml/qmllegend/main.qml +++ b/examples/datavisualization/qmllegend/qml/qmllegend/main.qml @@ -45,10 +45,7 @@ Rectangle { Item { id: dataView - anchors.top: buttonLayout.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right + anchors.fill: parent Bars3D { id: barGraph @@ -99,12 +96,18 @@ Rectangle { Rectangle { property int legendLocation: 3 + // Make the height and width fractional of main view height and width. + // Reverse the relation if screen is in portrait - this makes legend look the same + // if the orientation is rotated. + property int fractionalHeight: mainView.width > mainView.height ? mainView.height / 5 : mainView.width / 5 + property int fractionalWidth: mainView.width > mainView.height ? mainView.width / 5 : mainView.height / 5 id: legendPanel - width: 200 - height: 100 + width: fractionalWidth > 150 ? fractionalWidth : 150 + // Adjust legendpanel height to avoid gaps between layouted items. + height: fractionalHeight > 99 ? fractionalHeight - fractionalHeight % 3 : 99 border.color: barGraph.theme.labelTextColor - border.width: 2 + border.width: 3 color: "#00000000" // Transparent //! [0] @@ -152,7 +155,7 @@ Rectangle { when: legendPanel.legendLocation === 1 AnchorChanges { target: legendPanel - anchors.top: dataView.top + anchors.top: buttonLayout.bottom anchors.bottom: undefined anchors.left: dataView.left anchors.right: undefined @@ -163,7 +166,7 @@ Rectangle { when: legendPanel.legendLocation === 2 AnchorChanges { target: legendPanel - anchors.top: dataView.top + anchors.top: buttonLayout.bottom anchors.bottom: undefined anchors.left: undefined anchors.right: dataView.right diff --git a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml index eeaeab40..81884154 100644 --- a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml +++ b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml @@ -239,7 +239,7 @@ Item { Layout.fillHeight: true Layout.fillWidth: true - text: "Show Flat" + text: surfaceSeries.flatShadingSupported ? "Show Flat" : "Flat not supported" enabled: surfaceSeries.flatShadingSupported onClicked: { diff --git a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml index 69cb2834..6664dcfd 100644 --- a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml +++ b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml @@ -139,7 +139,8 @@ Rectangle { id: shadowToggle Layout.fillHeight: true Layout.fillWidth: true - text: "Hide Shadows" + text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" + enabled: scatterGraph.shadowsSupported onClicked: { if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftLow; diff --git a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml index f11d15f3..6eef6cc4 100644 --- a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml +++ b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml @@ -93,11 +93,6 @@ Rectangle { yPosRole: "height" } //! [6] - - onFlatShadingSupportedChanged: { - flatShadingToggle.text = "Flat not supported" - } - onDrawModeChanged: checkState() } //! [4] @@ -169,7 +164,7 @@ Rectangle { id: flatShadingToggle Layout.fillWidth: true Layout.fillHeight: true - text: "Show Flat" + text: surfaceSeries.flatShadingSupported ? "Show Flat" : "Flat not supported" enabled: surfaceSeries.flatShadingSupported //! [2] onClicked: { diff --git a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml b/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml index 0be991bc..1c15d919 100644 --- a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml +++ b/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml @@ -217,9 +217,10 @@ Item { NewButton { id: shadowButton - text: "Show Shadows" Layout.fillWidth: true Layout.minimumHeight: 40 + text: surfaceLayers.shadowsSupported ? "Show Shadows" : "Shadows not supported" + enabled: surfaceLayers.shadowsSupported onClicked: { if (surfaceLayers.shadowQuality === AbstractGraph3D.ShadowQualityNone) { surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityLow -- cgit v1.2.3