Mobile: move pageIndex function to main.qml

This way it can be more easily called from other pages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-10-07 22:33:44 -05:00
parent 2ef401ef5f
commit 2f0689d3b8
2 changed files with 9 additions and 9 deletions

View file

@ -90,6 +90,14 @@ Kirigami.ApplicationWindow {
pageStack.push(mapPage)
}
function pageIndex(pageToFind) {
for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) {
if (pageStack.contentItem.contentChildren[i] === pageToFind)
return i
}
return -1
}
function startAddDive() {
detailsWindow.state = "add"
detailsWindow.dive_id = manager.addDive();