mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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
|
left: currentItem ? (currentItem.modelData && currentItem.modelData.dive.gps !== "" ? mapAction : null) : null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PropertyChanges { target: detailsEditScroll; sheetOpen: false }
|
|
||||||
PropertyChanges { target: pageStack.contentItem; interactive: true }
|
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "edit"
|
name: "edit"
|
||||||
PropertyChanges { target: detailsEditScroll; sheetOpen: true }
|
PropertyChanges {
|
||||||
PropertyChanges { target: pageStack.contentItem; interactive: false }
|
target: diveDetailsPage;
|
||||||
|
actions {
|
||||||
|
right: cancelAction
|
||||||
|
left: null
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "add"
|
name: "add"
|
||||||
PropertyChanges { target: detailsEditScroll; sheetOpen: true }
|
PropertyChanges {
|
||||||
PropertyChanges { target: pageStack.contentItem; interactive: false }
|
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 {
|
property QtObject mapAction: Kirigami.Action {
|
||||||
text: qsTr("Show on map")
|
text: qsTr("Show on map")
|
||||||
iconName: "gps"
|
iconName: "gps"
|
||||||
|
@ -183,10 +199,9 @@ Kirigami.Page {
|
||||||
diveDetailsPage.state = "edit"
|
diveDetailsPage.state = "edit"
|
||||||
}
|
}
|
||||||
|
|
||||||
//onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning);
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
visible: diveDetailsPage.state == "view"
|
||||||
ListView {
|
ListView {
|
||||||
id: diveDetailsListView
|
id: diveDetailsListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -198,7 +213,6 @@ Kirigami.Page {
|
||||||
highlightFollowsCurrentItem: true
|
highlightFollowsCurrentItem: true
|
||||||
focus: true
|
focus: true
|
||||||
clip: false
|
clip: false
|
||||||
//cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels)
|
|
||||||
snapMode: ListView.SnapOneItem
|
snapMode: ListView.SnapOneItem
|
||||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||||
onMovementEnded: {
|
onMovementEnded: {
|
||||||
|
@ -219,18 +233,10 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
ScrollIndicator.horizontal: ScrollIndicator { }
|
ScrollIndicator.horizontal: ScrollIndicator { }
|
||||||
}
|
}
|
||||||
Kirigami.OverlaySheet {
|
|
||||||
id: detailsEditScroll
|
|
||||||
parent: diveDetailsPage
|
|
||||||
rootItem.z: 0
|
|
||||||
onSheetOpenChanged: {
|
|
||||||
if (!sheetOpen) {
|
|
||||||
endEditMode()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveDetailsEdit {
|
DiveDetailsEdit {
|
||||||
id: detailsEdit
|
id: detailsEdit
|
||||||
}
|
visible: diveDetailsPage.state != "view" ? true : false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue