From 9aa660e06ea83fa78d68266663b2a12d4c8f1d6d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 14 Jan 2021 13:47:39 -0800 Subject: mobile/UI: don't change the window size when gridUnits change QML and Kirigami trigger a change of our application window size if we manually override the gridUnit. Which of course is NOT what we want, so immediately undo that after changing the gridUnit to prevent bad side effects. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index de2e601f3..4e769e9be 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -690,11 +690,16 @@ if you have network connectivity and want to sync your data to cloud storage."), manager.appendTextToLog(numColumns + " columns with column width of " + rootItem.colWidth) manager.appendTextToLog("width in Grid Units " + widthInGridUnits + " original gridUnit " + Kirigami.Units.gridUnit + " now " + kirigamiGridUnit) if (Kirigami.Units.gridUnit !== kirigamiGridUnit) { - // change our global grid unit - make absolutely certain there is no Qt binding happening + // change our global grid unit and prevent Kirigami from resizing our rootItem + var fixWidth = rootItem.width + var fixHeight = rootItem.height Kirigami.Units.gridUnit = kirigamiGridUnit * 1.0 + rootItem.width = fixWidth + rootItem.height = fixHeight } + pageStack.defaultColumnWidth = rootItem.colWidth - manager.appendTextToLog("Done setting up sizes") + manager.appendTextToLog("Done setting up sizes width " + rootItem.width + " gridUnit " + kirigamiGridUnit) } QtObject { @@ -715,6 +720,7 @@ if you have network connectivity and want to sync your data to cloud storage."), onWidthChanged: { manager.appendTextToLog("[screensetup] width changed now " + width + " x " + height + " vs screen " + Screen.width + " x " + Screen.height) + if (screenSizeObject.lastOrientation === undefined) { manager.appendTextToLog("[screensetup] found initial orientation " + Screen.orientation) screenSizeObject.lastOrientation = Screen.orientation @@ -747,6 +753,7 @@ if you have network connectivity and want to sync your data to cloud storage."), manager.appendTextToLog("[screensetup] remembering better height") screenSizeObject.initialWidth = width } + setupUnits() } } } else { -- cgit v1.2.3-70-g09d2