diff options
author | Marco Martin <notmart@gmail.com> | 2017-03-31 16:15:14 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-04-01 09:35:51 +0200 |
commit | 751626eec574363ef694e1301744704915e6b2ea (patch) | |
tree | feebeca13c2405cf9a5501435bd85b9acf360b7f /mobile-widgets/qml/DiveDetails.qml | |
parent | 34a42d7f04319973cbecfcc3b21c6bf8b29f2a22 (diff) | |
download | subsurface-751626eec574363ef694e1301744704915e6b2ea.tar.gz |
QML UI: Fully port dive edit to Kirigami2
Completely adapt to the api changes of OverlaySheet in Kirigami2
in order to achieve the same look and behavior for the dive
edits that had with kirigami1
Port most components to QtQuickContrls2, except comboboxes
in the dive edit sheet that will need a new control type
Signed-off-by: Marco Martin <notmart@gmail.com>
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() } } |