From 9beca180adc3109e9e258cbf54459960b33fa7d6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 3 Jun 2014 10:36:46 +0300 Subject: Misc fixes for bugs found during examples testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - qmlbars TableView year/month display got messed up when scrolled. - qmllegend black background on transparent item bug was back due to some changes in 5.3. Worked around the issue differently. - qmloscilloscope displayed warnings about circular property binding. - Incorrect count was used to determine amount of labels for rows in bar charts. Change-Id: Id5851019af258c256a92648561bb8ce766993b5c Reviewed-by: Tomi Korpipää --- .../datavisualization/qmlbars/qml/qmlbars/main.qml | 22 +++++++++++++--------- .../qmllegend/qml/qmllegend/LegendItem.qml | 6 ++++++ .../qmllegend/qml/qmllegend/main.qml | 12 ------------ .../qmloscilloscope/qml/qmloscilloscope/main.qml | 17 ++++++++--------- 4 files changed, 27 insertions(+), 30 deletions(-) (limited to 'examples/datavisualization') diff --git a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml index 32767cc4..5172e27d 100644 --- a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml +++ b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml @@ -185,18 +185,22 @@ Rectangle { anchors.right: parent.right color: styleData.textColor elide: styleData.elideMode - text: styleData.value + text: customText horizontalAlignment: styleData.textAlignment - property bool customFormatted: false + property string originalText: styleData.value + property string customText - onTextChanged: { - if (styleData.column === 0 && !customFormatted) { - customFormatted = true - var pattern = /(\d\d\d\d)-(\d\d)/ - var matches = pattern.exec(delegateText.text) - var colIndex = parseInt(matches[2], 10) - 1 - delegateText.text = matches[1] + " - " + graphAxes.column.labels[colIndex] + onOriginalTextChanged: { + if (styleData.column === 0) { + if (delegateText.originalText !== "") { + var pattern = /(\d\d\d\d)-(\d\d)/ + var matches = pattern.exec(delegateText.originalText) + var colIndex = parseInt(matches[2], 10) - 1 + delegateText.customText = matches[1] + " - " + graphAxes.column.labels[colIndex] + } + } else { + delegateText.customText = originalText } } } diff --git a/examples/datavisualization/qmllegend/qml/qmllegend/LegendItem.qml b/examples/datavisualization/qmllegend/qml/qmllegend/LegendItem.qml index 50be7a8d..f8c71650 100644 --- a/examples/datavisualization/qmllegend/qml/qmllegend/LegendItem.qml +++ b/examples/datavisualization/qmllegend/qml/qmllegend/LegendItem.qml @@ -31,6 +31,12 @@ Rectangle { id: legendItem state: "unselected" + // Workaround for a layout bug that in some situations causes changing from fully opaque color + // to a transparent one to use black background instead of what is actually under the items. + // Having the control always slighthly transparent forces the background to be refreshed + // properly. + opacity: 0.999 + //! [1] RowLayout { anchors.fill: parent diff --git a/examples/datavisualization/qmllegend/qml/qmllegend/main.qml b/examples/datavisualization/qmllegend/qml/qmllegend/main.qml index f7e2d803..0fe107cb 100644 --- a/examples/datavisualization/qmllegend/qml/qmllegend/main.qml +++ b/examples/datavisualization/qmllegend/qml/qmllegend/main.qml @@ -121,34 +121,22 @@ Rectangle { Layout.fillHeight: true series: station1 theme: barGraph.theme - onColorChanged: legendPanel.relayout() } LegendItem { Layout.fillWidth: true Layout.fillHeight: true series: station2 theme: barGraph.theme - onColorChanged: legendPanel.relayout() } LegendItem { Layout.fillWidth: true Layout.fillHeight: true series: station3 theme: barGraph.theme - onColorChanged: legendPanel.relayout() } } //! [0] - function relayout() { - // Workaround for a layout bug that causes transparent colors to use black background - // instead of what is actually under the items if just the color changes. - // Forcing a relayout by adjusting layout's available area fixes the background. - var originalWidth = border.width - border.width = originalWidth + 1 - border.width = originalWidth - } - states: [ State { name: "topleft" diff --git a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml index 1373d4f9..c2e6b70b 100644 --- a/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml +++ b/examples/datavisualization/qmloscilloscope/qml/qmloscilloscope/main.qml @@ -82,6 +82,13 @@ Item { meshSmooth: true itemLabelFormat: "@xLabel, @zLabel: @yLabel" itemLabelVisible: false + + onItemLabelChanged: { + if (surfaceSeries.selectedPoint === surfaceSeries.invalidSelectionPosition) + selectionText.text = "No selection" + else + selectionText.text = surfaceSeries.itemLabel + } } //! [0] @@ -244,15 +251,7 @@ Item { anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - - Binding on text { - when: surfaceSeries.itemLabel.length - value: surfaceSeries.itemLabel - } - Binding on text { - when: !surfaceSeries.itemLabel.length - value: "No selection" - } + text: "No selection" } } } -- cgit v1.2.3