aboutsummaryrefslogtreecommitdiffstats
path: root/examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml')
-rw-r--r--examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml b/examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml
new file mode 100644
index 000000000..003556c51
--- /dev/null
+++ b/examples/location/mapviewer/MapViewer/forms/RouteCoordinate.qml
@@ -0,0 +1,41 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtPositioning
+
+RouteCoordinateForm {
+ property variant toCoordinate
+ property variant fromCoordinate
+ signal showRoute(variant startCoordinate,variant endCoordinate)
+ signal closeForm()
+
+ goButton.onClicked: {
+ var startCoordinate = QtPositioning.coordinate(parseFloat(fromLatitude.text),
+ parseFloat(fromLongitude.text));
+ var endCoordinate = QtPositioning.coordinate(parseFloat(toLatitude.text),
+ parseFloat(toLongitude.text));
+ if (startCoordinate.isValid && endCoordinate.isValid) {
+ goButton.enabled = false;
+ showRoute(startCoordinate,endCoordinate)
+ }
+ }
+
+ clearButton.onClicked: {
+ fromLatitude.text = ""
+ fromLongitude.text = ""
+ toLatitude.text = ""
+ toLongitude.text = ""
+ }
+
+ cancelButton.onClicked: {
+ closeForm()
+ }
+
+ Component.onCompleted: {
+ fromLatitude.text = "" + fromCoordinate.latitude
+ fromLongitude.text = "" + fromCoordinate.longitude
+ toLatitude.text = "" + toCoordinate.latitude
+ toLongitude.text = "" + toCoordinate.longitude
+ }
+}