From 35f1b9e2044ec1891331102881cd354199a64baa Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 18 Jan 2021 07:52:03 -0800 Subject: mobile/statistics: force redraw after rotation Sometimes (and it's unclear why that happens) after rotation the stats widget is blank. Setting the first variable back to itself appears enough to ensure that the statistics view is redrawn. Try to do that programatically after a short delay. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/StatisticsPage.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mobile-widgets/qml/StatisticsPage.qml b/mobile-widgets/qml/StatisticsPage.qml index 97d504222..0a9a7bdea 100644 --- a/mobile-widgets/qml/StatisticsPage.qml +++ b/mobile-widgets/qml/StatisticsPage.qml @@ -32,6 +32,18 @@ Kirigami.Page { statsManager.doit() } } + onWideChanged: { + // so this means we rotated the device - and sometimes after rotation + // the stats widget is empty. + rotationRedrawTrigger.start() + } + Timer { + // wait .5 seconds (so the OS rotation animation has a chance to run) and then set var1 again + // to its current value, which appears to be enough to ensure that the chart is drawn again + id: rotationRedrawTrigger + interval: 500 + onTriggered: statsManager.var1Changed(i1.var1currentIndex) + } Component { id: chartListDelegate @@ -89,6 +101,7 @@ Kirigami.Page { Layout.row: 0 Layout.leftMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing + property alias var1currentIndex: var1.currentIndex TemplateLabelSmall { text: qsTr("Base variable") } -- cgit v1.2.3-70-g09d2