diff options
Diffstat (limited to 'examples/datavisualization/qmllegend/qml')
-rw-r--r-- | examples/datavisualization/qmllegend/qml/qmllegend/LegendItem.qml | 6 | ||||
-rw-r--r-- | examples/datavisualization/qmllegend/qml/qmllegend/main.qml | 12 |
2 files changed, 6 insertions, 12 deletions
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" |