From 7dfd22e942567bf151a8d373a64e6aed2e662b89 Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Sat, 7 Jan 2023 19:22:04 +0000 Subject: Add a page for editing and deleting waypoints --- src/MainMapView.qml | 4 ++++ src/MapWaypoint.qml | 2 ++ src/SetPointPage.qml | 30 ++++++++++++++++++------------ 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 2cefbeb..40c42c8 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -78,6 +78,7 @@ Item { mapItem.coordinate = QtPositioning.coordinate(currWaypointCoord[0],currWaypointCoord[1]) mapItem.iconName = currWaypointData[0] mapItem.iconColor = currWaypointData[2] + mapItem.index = i mapView.addMapItem(mapItem) } } @@ -96,6 +97,9 @@ Item { pageStack.push(setPointPage,{coord: mapView.center}) } } + function editWaypoint(number) { + console.log("invoking the edit page for waypoint number ", number) + } Component { id: waypoint MapWaypoint { diff --git a/src/MapWaypoint.qml b/src/MapWaypoint.qml index 3a56dcc..f40f62d 100644 --- a/src/MapWaypoint.qml +++ b/src/MapWaypoint.qml @@ -11,6 +11,7 @@ MapQuickItem { autoFadeIn: false property string iconName property color iconColor + property int index sourceItem: Asteroid.IconButton { width: Asteroid.Dims.w(12) iconName: "waypoint" @@ -23,5 +24,6 @@ MapQuickItem { name: root.iconName color: root.iconColor } + onClicked: editWaypoint(index) } } diff --git a/src/SetPointPage.qml b/src/SetPointPage.qml index e036001..1b5f571 100644 --- a/src/SetPointPage.qml +++ b/src/SetPointPage.qml @@ -6,11 +6,6 @@ import Nemo.Configuration 1.0 Item { id: root - // FlatMesh { - // centerColor: "#003ee9" - // outerColor: "#00bc1b" - // anchors.fill: parent - // } Asteroid.PageHeader { text: "Add waypoint" } @@ -41,7 +36,7 @@ Item { ListView { id: iconSelectorView width: parent.width - height: width*0.2 + height: root.height*0.2 orientation: ListView.Horizontal model: iconModel delegate: Asteroid.IconButton { @@ -79,12 +74,23 @@ Item { } } } - Asteroid.IconButton { - width: parent.width*0.2 - height: width - iconName: "ios-checkmark-circle-outline" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: appendWayPoint() + Row { + height: root.width*0.2 + width: parent.width + Asteroid.IconButton { + height: parent.height + width: height + iconName: "ios-checkmark-circle-outline" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: appendWayPoint() + } + Asteroid.IconButton { + height: parent.height + width: height + iconName: "ios-trash-circle" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: removeWaypoint() + } } Item { width: parent.width ; height: root.width*0.2 } } -- cgit v1.2.3-54-g00ecf