summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/main.qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-06 18:48:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-13 11:32:27 -0700
commit4e4fcda91c858dd0a14d5b6c02528723831bac56 (patch)
tree99d7f62aac395647bd26d10ee73c8e58e58e5d90 /mobile-widgets/qml/main.qml
parent8cd1abb7f7d8c6c36da30590168fb4114bb9509f (diff)
downloadsubsurface-4e4fcda91c858dd0a14d5b6c02528723831bac56.tar.gz
Mobile: insane hack to make map page work
This makes no sense and seems crazy. But it also seems to work, For some reason with the current Kirigami version and Qt 5.13.1 selecting the map page makes the pageStack jump back to the previous page right away. I cannot find what triggers this behavior. Since I cannot fix the root cause, I am working around the bug. When we select the map page we remember that fact and when a different page is picked with the mapPage being the last page on the stack, we force the page selection back to the map page. I can imagine countless ways in which this could go horribly wrong - but right now I can't figure out a better solution. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml/main.qml')
-rw-r--r--mobile-widgets/qml/main.qml24
1 files changed, 22 insertions, 2 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index b90ebac15..e7678688d 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -34,6 +34,7 @@ Kirigami.ApplicationWindow {
property bool firstChange: true
property int lastOrientation: undefined
property int colWidth: undefined
+ property bool hackToOpenMap: false
onNotificationTextChanged: {
if (notificationText != "") {
@@ -615,12 +616,31 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
pageStack.onCurrentItemChanged: {
- // This is called whenever the user navigates using the breadcrumbs in the header
+ // This is called whenever the user navigates using the breadcrumbs in the header
- // disable the left swipe to go back when on the map page
if (pageStack.currentItem === null) {
console.log("there's no current page")
} else {
+ // horrible, insane hack to make picking the mapPage work
+ // for some reason I cannot figure out, whenever the mapPage is selected
+ // we immediately switch back to the page before it - so force-prevent
+ // that undersired behavior
+ if (pageStack.currentItem.objectName === mapPage.objectName) {
+ // remember that we actively picked the mapPage
+ hackToOpenMap = true
+ } else if (pageStack.currentItem.objectName !== mapPage.objectName &&
+ pageStack.lastItem.objectName === mapPage.objectName &&
+ hackToOpenMap) {
+ // if we just picked the mapPage and are suddenly back on a different page
+ // force things back to the mapPage
+ pageStack.currentIndex = pageStack.contentItem.contentChildren.length - 1
+ hackToOpenMap = false
+ } else {
+ // if we picked a different page reset the mapPage hack
+ hackToOpenMap = false
+ }
+
+ // disable the left swipe to go back when on the map page
pageStack.interactive = pageStack.currentItem.objectName !== mapPage.objectName
// is there a better way to reload the map markers instead of doing that