diff options
Diffstat (limited to 'mobile-widgets/qml/DiveDetails.qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 076a63576..a5da856ee 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -1,10 +1,9 @@ import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.2 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { id: diveDetailsPage // but this is referenced as detailsWindow @@ -52,23 +51,23 @@ Kirigami.Page { left: diveDetailsListView.currentItem ? (diveDetailsListView.currentItem.modelData.dive.gps !== "" ? mapAction : null) : null } } - PropertyChanges { target: detailsEditScroll; opened: false } + PropertyChanges { target: detailsEditScroll; sheetOpen: false } PropertyChanges { target: pageStack.contentItem; interactive: true } }, State { name: "edit" - PropertyChanges { target: detailsEditScroll; opened: true } + PropertyChanges { target: detailsEditScroll; sheetOpen: true } PropertyChanges { target: pageStack.contentItem; interactive: false } }, State { name: "add" - PropertyChanges { target: detailsEditScroll; opened: true } + PropertyChanges { target: detailsEditScroll; sheetOpen: true } PropertyChanges { target: pageStack.contentItem; interactive: false } } ] - property QtObject deleteAction: Action { + property QtObject deleteAction: Kirigami.Action { text: qsTr("Delete dive") iconName: "trash-empty" onTriggered: { @@ -85,7 +84,7 @@ Kirigami.Page { } } - property QtObject mapAction: Action { + property QtObject mapAction: Kirigami.Action { text: qsTr("Show on map") iconName: "gps" onTriggered: { @@ -93,7 +92,7 @@ Kirigami.Page { } } - actions.main: Action { + actions.main: Kirigami.Action { iconName: state !== "view" ? "document-save" : "document-edit" onTriggered: { manager.appendTextToLog("save/edit button triggered") @@ -175,48 +174,44 @@ Kirigami.Page { Item { anchors.fill: parent - ScrollView { - id: diveDetailList + ListView { + id: diveDetailsListView anchors.fill: parent - ListView { - id: diveDetailsListView - anchors.fill: parent - model: diveModel - currentIndex: -1 + model: diveModel + currentIndex: -1 + boundsBehavior: Flickable.StopAtBounds + maximumFlickVelocity: parent.width * 5 + orientation: ListView.Horizontal + 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: { + currentIndex = indexAt(contentX+1, 1); + } + delegate: Flickable { + id: internalScrollView + width: diveDetailsListView.width + height: diveDetailsListView.height + contentHeight: diveDetails.height boundsBehavior: Flickable.StopAtBounds - maximumFlickVelocity: parent.width * 5 - orientation: ListView.Horizontal - 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: { - currentIndex = indexAt(contentX+1, 1); - } - delegate: ScrollView { - id: internalScrollView - width: diveDetailsListView.width - height: diveDetailsListView.height - property var modelData: model - Flickable { - //contentWidth: parent.width - contentHeight: diveDetails.height - boundsBehavior: Flickable.StopAtBounds - DiveDetailsView { - id: diveDetails - width: internalScrollView.width - } - } + property var modelData: model + DiveDetailsView { + id: diveDetails + width: internalScrollView.width } + ScrollBar.vertical: ScrollBar { } } + ScrollIndicator.horizontal: ScrollIndicator { } } Kirigami.OverlaySheet { id: detailsEditScroll - anchors.fill: parent - onOpenedChanged: { - if (!opened) { + parent: diveDetailsPage + rootItem.z: 0 + onSheetOpenChanged: { + if (!sheetOpen) { endEditMode() } } |