summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--mobile-widgets/qml/main.qml8
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index baac1bb91..2a40d7b4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+Mobile: add option to only show one column in portrait mode
Mobile: fix potential crash when adding / editing dives
Mobile: automatically scroll the dive edit screen so that the notes edit cursor stays visible
Desktop: ignore dive sites without location in proximity search
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 752fc0c56..679e54131 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -571,7 +571,12 @@ if you have network connectivity and want to sync your data to cloud storage."),
function setupUnits() {
// some screens are too narrow for Subsurface-mobile to render well
// try to hack around that by making sure that we can fit at least 21 gridUnits in a row
- var numColumns = Math.floor(rootItem.width/pageStack.defaultColumnWidth)
+ var numColumns = Math.max(Math.floor(rootItem.width / (21 * Kirigami.Units.gridUnit)), 1)
+ if (Screen.primaryOrientation === Qt.PortraitOrientation && PrefDisplay.singleColumnPortrait) {
+ manager.appendTextToLog("show only one column in portrait mode");
+ numColumns = 1;
+ }
+
rootItem.colWidth = numColumns > 1 ? Math.floor(rootItem.width / numColumns) : rootItem.width;
var kirigamiGridUnit = Kirigami.Units.gridUnit
var widthInGridUnits = Math.floor(rootItem.colWidth / kirigamiGridUnit)
@@ -587,6 +592,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
// change our glabal grid unit
Kirigami.Units.gridUnit = kirigamiGridUnit
}
+ pageStack.defaultColumnWidth = rootItem.colWidth
manager.appendTextToLog("Done setting up sizes")
}