mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:23:23 +00:00
QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data) should no longer happen. See: #495 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
41f24f2859
commit
7f0c7eeb24
1 changed files with 28 additions and 22 deletions
|
@ -58,18 +58,26 @@ Kirigami.Page {
|
|||
left: currentItem ? (currentItem.modelData && currentItem.modelData.dive.gps !== "" ? mapAction : null) : null
|
||||
}
|
||||
}
|
||||
PropertyChanges { target: detailsEditScroll; sheetOpen: false }
|
||||
PropertyChanges { target: pageStack.contentItem; interactive: true }
|
||||
},
|
||||
State {
|
||||
name: "edit"
|
||||
PropertyChanges { target: detailsEditScroll; sheetOpen: true }
|
||||
PropertyChanges { target: pageStack.contentItem; interactive: false }
|
||||
PropertyChanges {
|
||||
target: diveDetailsPage;
|
||||
actions {
|
||||
right: cancelAction
|
||||
left: null
|
||||
}
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "add"
|
||||
PropertyChanges { target: detailsEditScroll; sheetOpen: true }
|
||||
PropertyChanges { target: pageStack.contentItem; interactive: false }
|
||||
PropertyChanges {
|
||||
target: diveDetailsPage;
|
||||
actions {
|
||||
right: cancelAction
|
||||
left: null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
@ -89,6 +97,14 @@ Kirigami.Page {
|
|||
}
|
||||
}
|
||||
|
||||
property QtObject cancelAction: Kirigami.Action {
|
||||
text: qsTr("Cancel edit")
|
||||
iconName: "dialog-cancel"
|
||||
onTriggered: {
|
||||
endEditMode()
|
||||
}
|
||||
}
|
||||
|
||||
property QtObject mapAction: Kirigami.Action {
|
||||
text: qsTr("Show on map")
|
||||
iconName: "gps"
|
||||
|
@ -183,10 +199,9 @@ Kirigami.Page {
|
|||
diveDetailsPage.state = "edit"
|
||||
}
|
||||
|
||||
//onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning);
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
visible: diveDetailsPage.state == "view"
|
||||
ListView {
|
||||
id: diveDetailsListView
|
||||
anchors.fill: parent
|
||||
|
@ -198,7 +213,6 @@ Kirigami.Page {
|
|||
highlightFollowsCurrentItem: true
|
||||
focus: true
|
||||
clip: false
|
||||
//cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels)
|
||||
snapMode: ListView.SnapOneItem
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||
onMovementEnded: {
|
||||
|
@ -219,18 +233,10 @@ Kirigami.Page {
|
|||
}
|
||||
ScrollIndicator.horizontal: ScrollIndicator { }
|
||||
}
|
||||
Kirigami.OverlaySheet {
|
||||
id: detailsEditScroll
|
||||
parent: diveDetailsPage
|
||||
rootItem.z: 0
|
||||
onSheetOpenChanged: {
|
||||
if (!sheetOpen) {
|
||||
endEditMode()
|
||||
}
|
||||
}
|
||||
DiveDetailsEdit {
|
||||
id: detailsEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DiveDetailsEdit {
|
||||
id: detailsEdit
|
||||
visible: diveDetailsPage.state != "view" ? true : false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue