diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-01-14 13:47:39 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-19 12:35:29 -0800 |
commit | 9aa660e06ea83fa78d68266663b2a12d4c8f1d6d (patch) | |
tree | a07dc1ae76624babf59590adb6e63f58a63007d7 /mobile-widgets | |
parent | cb71fb28227f2ff57604b4adafe192c8ba1f7743 (diff) | |
download | subsurface-9aa660e06ea83fa78d68266663b2a12d4c8f1d6d.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/main.qml | 11 |
1 files changed, 9 insertions, 2 deletions
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 { |