diff options
Diffstat (limited to 'examples/location/mapviewer/MapViewer/forms')
15 files changed, 1151 insertions, 0 deletions
diff --git a/examples/location/mapviewer/MapViewer/forms/Geocode.qml b/examples/location/mapviewer/MapViewer/forms/Geocode.qml new file mode 100644 index 000000000..885357dd3 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/Geocode.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtPositioning + +GeocodeForm { + + property variant address + signal showPlace(variant address) + signal closeForm() + + goButton.onClicked: { + // fill out the Address element + address.street = street.text + address.city = city.text + address.state = stateName.text + address.country = country.text + address.postalCode = postalCode.text + showPlace(address) + } + + clearButton.onClicked: { + street.text = "" + city.text = "" + stateName.text = "" + country.text = "" + postalCode.text = "" + } + + cancelButton.onClicked: { + closeForm() + } + + Component.onCompleted: { + street.text = address.street + city.text = address.city + stateName.text = address.state + country.text = address.country + postalCode.text = address.postalCode + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/GeocodeForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/GeocodeForm.ui.qml new file mode 100644 index 000000000..cb56370ea --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/GeocodeForm.ui.qml @@ -0,0 +1,136 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property alias goButton: goButton + property alias clearButton: clearButton + property alias postalCode: postalCode + property alias street: street + property alias city: city + property alias stateName: stateName + property alias country: country + property alias cancelButton: cancelButton + Rectangle { + id: tabRectangle + y: 20 + height: tabTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: qsTr("Geocode") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + id: item2 + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + + GridLayout { + id: gridLayout3 + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + anchors.leftMargin: 0 + anchors.topMargin: 0 + rowSpacing: 10 + rows: 1 + columns: 2 + anchors.fill: parent + + Label { + id: label2 + text: qsTr("Street") + } + + TextField { + id: street + Layout.fillWidth: true + } + + Label { + id: label3 + text: qsTr("City") + } + + TextField { + id: city + Layout.fillWidth: true + } + + Label { + id: label4 + text: qsTr("State") + } + + TextField { + id: stateName + Layout.fillWidth: true + } + + Label { + id: label5 + text: qsTr("Country") + } + + TextField { + id: country + Layout.fillWidth: true + } + + Label { + id: label6 + text: qsTr("Postal Code") + } + + TextField { + id: postalCode + Layout.fillWidth: true + } + + RowLayout { + id: rowLayout1 + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignRight + + Button { + id: goButton + text: qsTr("Proceed") + } + + Button { + id: clearButton + text: qsTr("Clear") + } + + Button { + id: cancelButton + text: qsTr("Cancel") + } + } + + Item { + Layout.fillHeight: true + Layout.columnSpan: 2 + } + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/Locale.qml b/examples/location/mapviewer/MapViewer/forms/Locale.qml new file mode 100644 index 000000000..9ba7dd7f0 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/Locale.qml @@ -0,0 +1,45 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtPositioning + +LocaleForm { + property string locale + signal selectLanguage(string language) + signal closeForm() + + goButton.onClicked: { + + if (!languageGroup.checkedButton) return + + if (otherRadioButton.checked) { + selectLanguage(language.text) + } else { + selectLanguage(languageGroup.checkedButton.text) + } + } + + clearButton.onClicked: { + language.text = "" + } + + cancelButton.onClicked: { + closeForm() + } + + Component.onCompleted: { + switch (locale) { + case "en": + enRadioButton.checked = true; + break + case "fr": + frRadioButton.checked = true; + break + default: + otherRadioButton.checked = true; + language.text = locale + break + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/LocaleForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/LocaleForm.ui.qml new file mode 100644 index 000000000..9e1ec1807 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/LocaleForm.ui.qml @@ -0,0 +1,116 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property alias clearButton: clearButton + property alias goButton: goButton + property alias cancelButton: cancelButton + property alias tabTitle: tabTitle + property alias languageGroup: languageGroup + property alias enRadioButton: enRadioButton + property alias frRadioButton: frRadioButton + property alias otherRadioButton: otherRadioButton + property alias language: language + + Rectangle { + id: tabRectangle + y: 20 + height: tabTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: "Locale" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + id: item2 + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + GridLayout { + id: gridLayout3 + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + anchors.leftMargin: 0 + anchors.topMargin: 0 + rowSpacing: 10 + rows: 1 + columns: 2 + anchors.fill: parent + + ButtonGroup { id: languageGroup } + RadioButton { + id: enRadioButton + text: qsTr("en") + ButtonGroup.group: languageGroup + Layout.columnSpan: 2 + } + + RadioButton { + id: frRadioButton + text: qsTr("fr") + ButtonGroup.group: languageGroup + Layout.columnSpan: 2 + } + + RadioButton { + id: otherRadioButton + text: qsTr("Other") + ButtonGroup.group: languageGroup + } + + TextField { + id: language + Layout.fillWidth: true + placeholderText: qsTr("") + } + + RowLayout { + id: rowLayout1 + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignRight + + Button { + id: goButton + text: qsTr("Proceed") + } + + Button { + id: clearButton + text: qsTr("Clear") + } + + Button { + id: cancelButton + text: qsTr("Cancel") + } + } + + Item { + Layout.fillHeight: true + Layout.columnSpan: 2 + } + + + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/Message.qml b/examples/location/mapviewer/MapViewer/forms/Message.qml new file mode 100644 index 000000000..583bc2dda --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/Message.qml @@ -0,0 +1,21 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +MessageForm { + property string title + property string message + property variant backPage + + signal closeForm(variant backPage) + + button.onClicked: { + closeForm(backPage) + } + + Component.onCompleted: { + messageText.text = message + messageTitle.text = title + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/MessageForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/MessageForm.ui.qml new file mode 100644 index 000000000..426c72757 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/MessageForm.ui.qml @@ -0,0 +1,69 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + id: root + property alias messageText: messageText + property alias messageTitle: messageTitle + property alias button: button + + Rectangle { + id: tabRectangle + y: 20 + height: messageTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: messageTitle + color: "#ffffff" + text: qsTr("type") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + ColumnLayout { + id: columnLayout1 + spacing: 20 + anchors.fill: parent + + Label { + id: messageText + text: qsTr("message") + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + textFormat: Text.RichText + } + + Button { + id: button + text: qsTr("OK") + Layout.alignment: Qt.AlignHCenter + } + + Item { + Layout.fillHeight: true + } + } + } +} + diff --git a/examples/location/mapviewer/MapViewer/forms/ReverseGeocode.qml b/examples/location/mapviewer/MapViewer/forms/ReverseGeocode.qml new file mode 100644 index 000000000..31122a2e9 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/ReverseGeocode.qml @@ -0,0 +1,38 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtPositioning + +//Reverse Geocode Dialog +ReverseGeocodeForm { + property string title; + property variant coordinate + signal showPlace(variant coordinate) + signal closeForm() + + goButton.onClicked: { + var coordinate = QtPositioning.coordinate(parseFloat(latitude.text), + parseFloat(longitude.text)); + if (coordinate.isValid) { + showPlace(coordinate) + } + } + + clearButton.onClicked: { + latitude.text = "" + longitude.text = "" + } + + cancelButton.onClicked: { + closeForm() + } + + Component.onCompleted: { + latitude.text = "" + coordinate.latitude + longitude.text = "" + coordinate.longitude + if (title.length != 0) { + tabTitle.text = title; + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/ReverseGeocodeForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/ReverseGeocodeForm.ui.qml new file mode 100644 index 000000000..1d937ee90 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/ReverseGeocodeForm.ui.qml @@ -0,0 +1,103 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property alias clearButton: clearButton + property alias goButton: goButton + property alias longitude: longitude + property alias latitude: latitude + property alias cancelButton: cancelButton + property alias tabTitle: tabTitle + Rectangle { + id: tabRectangle + y: 20 + height: tabTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: qsTr("Reverse Geocode") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + id: item2 + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + GridLayout { + id: gridLayout3 + anchors.rightMargin: 0 + anchors.bottomMargin: 0 + anchors.leftMargin: 0 + anchors.topMargin: 0 + rowSpacing: 10 + rows: 1 + columns: 2 + anchors.fill: parent + + Label { + id: label2 + text: qsTr("Latitude") + } + + TextField { + id: latitude + Layout.fillWidth: true + } + + Label { + id: label3 + text: qsTr("Longitude") + } + + TextField { + id: longitude + Layout.fillWidth: true + placeholderText: qsTr("") + } + + RowLayout { + id: rowLayout1 + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignRight + + Button { + id: goButton + text: qsTr("Proceed") + } + + Button { + id: clearButton + text: qsTr("Clear") + } + + Button { + id: cancelButton + text: qsTr("Cancel") + } + } + Item { + Layout.fillHeight: true + Layout.columnSpan: 2 + } + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/RouteAddress.qml b/examples/location/mapviewer/MapViewer/forms/RouteAddress.qml new file mode 100644 index 000000000..3676c1374 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteAddress.qml @@ -0,0 +1,105 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtLocation +import QtPositioning + +RouteAddressForm { + property alias plugin : tempGeocodeModel.plugin; + property variant fromAddress; + property variant toAddress; + signal showMessage(string topic, string message) + signal showRoute(variant startCoordinate,variant endCoordinate) + signal closeForm() + + goButton.onClicked: { + tempGeocodeModel.reset() + fromAddress.country = fromCountry.text + fromAddress.street = fromStreet.text + fromAddress.city = fromCity.text + toAddress.country = toCountry.text + toAddress.street = toStreet.text + toAddress.city = toCity.text + tempGeocodeModel.startCoordinate = QtPositioning.coordinate() + tempGeocodeModel.endCoordinate = QtPositioning.coordinate() + tempGeocodeModel.query = fromAddress + tempGeocodeModel.update(); + goButton.enabled = false; + } + + clearButton.onClicked: { + fromStreet.text = "" + fromCity.text = "" + fromCountry.text = "" + toStreet.text = "" + toCity.text = "" + toCountry.text = "" + } + + cancelButton.onClicked: { + closeForm() + } + + Component.onCompleted: { + fromStreet.text = fromAddress.street + fromCity.text = fromAddress.city + fromCountry.text = fromAddress.country + toStreet.text = toAddress.street + toCity.text = toAddress.city + toCountry.text = toAddress.country + } + + GeocodeModel { + id: tempGeocodeModel + + property int success: 0 + property variant startCoordinate + property variant endCoordinate + + onCountChanged: { + if (success == 1 && count == 1) { + query = toAddress + update(); + } + } + + onStatusChanged: { + if ((status == GeocodeModel.Ready) && (count == 1)) { + success++ + if (success == 1) { + startCoordinate.latitude = get(0).coordinate.latitude + startCoordinate.longitude = get(0).coordinate.longitude + } + if (success == 2) { + endCoordinate.latitude = get(0).coordinate.latitude + endCoordinate.longitude = get(0).coordinate.longitude + success = 0 + if (startCoordinate.isValid && endCoordinate.isValid) + showRoute(startCoordinate,endCoordinate) + else + goButton.enabled = true + } + } else if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)) { + var st = (success == 0 ) ? "start" : "end" + success = 0 + if ((status == GeocodeModel.Ready) && (count == 0 )) { + showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode")); + goButton.enabled = true; + } + else if (status == GeocodeModel.Error) { + showMessage(qsTr("Geocode Error"), + qsTr("Unable to find location for the") + " " + + st + " " +qsTr("point")) + goButton.enabled = true; + } + else if ((status == GeocodeModel.Ready) && (count > 1 )) { + showMessage(qsTr("Ambiguous geocode"), + count + " " + qsTr("results found for the") + + " " + st + " " +qsTr("point, please specify location")) + goButton.enabled = true; + } + } + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/RouteAddressForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/RouteAddressForm.ui.qml new file mode 100644 index 000000000..ee9227013 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteAddressForm.ui.qml @@ -0,0 +1,160 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property alias fromStreet: fromStreet + property alias fromCountry: fromCountry + property alias toStreet: toStreet + property alias toCity: toCity + property alias toCountry: toCountry + property alias fromCity: fromCity + property alias goButton: goButton + property alias clearButton: clearButton + property alias cancelButton: cancelButton + + Rectangle { + id: tabRectangle + y: 20 + height: tabTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: qsTr("Route Address") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + id: item2 + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + GridLayout { + id: gridLayout3 + rowSpacing: 10 + rows: 1 + columns: 2 + anchors.fill: parent + + Label { + id: label1 + text: qsTr("From") + font.bold: true + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + } + + Label { + id: label2 + text: qsTr("Street") + } + + TextField { + id: fromStreet + Layout.fillWidth: true + } + + Label { + id: label3 + text: qsTr("City") + } + + TextField { + id: fromCity + Layout.fillWidth: true + } + + Label { + id: label7 + text: qsTr("Country") + } + + TextField { + id: fromCountry + Layout.fillWidth: true + } + + Label { + id: label6 + text: qsTr("To") + font.bold: true + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + } + + Label { + id: label4 + text: qsTr("Street") + } + + TextField { + id: toStreet + Layout.fillWidth: true + } + + Label { + id: label5 + text: qsTr("City") + } + + TextField { + id: toCity + Layout.fillWidth: true + } + + Label { + id: label8 + text: qsTr("Country") + } + + TextField { + id: toCountry + Layout.fillWidth: true + } + + RowLayout { + id: rowLayout1 + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignRight + + Button { + id: goButton + text: qsTr("Proceed") + } + + Button { + id: clearButton + text: qsTr("Clear") + } + + Button { + id: cancelButton + text: qsTr("Cancel") + } + } + + Item { + Layout.fillHeight: true + Layout.columnSpan: 2 + } + } + } +} 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 + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/RouteCoordinateForm.ui.qml b/examples/location/mapviewer/MapViewer/forms/RouteCoordinateForm.ui.qml new file mode 100644 index 000000000..88ff94dc1 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteCoordinateForm.ui.qml @@ -0,0 +1,136 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + property alias fromLatitude: fromLatitude + property alias fromLongitude: fromLongitude + property alias toLatitude: toLatitude + property alias toLongitude: toLongitude + property alias clearButton: clearButton + property alias goButton: goButton + property alias cancelButton: cancelButton + + Rectangle { + id: tabRectangle + y: 20 + height: tabTitle.height * 2 + color: "#46a2da" + anchors.rightMargin: 0 + anchors.leftMargin: 0 + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: qsTr("Route Coordinates") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Item { + id: item2 + anchors.rightMargin: 20 + anchors.leftMargin: 20 + anchors.bottomMargin: 20 + anchors.topMargin: 20 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.top: tabRectangle.bottom + + GridLayout { + id: gridLayout3 + rowSpacing: 10 + rows: 1 + columns: 2 + anchors.fill: parent + + Label { + id: label1 + text: qsTr("From") + font.bold: true + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + } + + Label { + id: label2 + text: qsTr("Latitude") + } + + TextField { + id: fromLatitude + Layout.fillWidth: true + } + + Label { + id: label3 + text: qsTr("Longitude") + } + + TextField { + id: fromLongitude + Layout.fillWidth: true + } + + Label { + id: label6 + text: qsTr("To") + font.bold: true + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + } + + Label { + id: label4 + text: qsTr("Latitude") + } + + TextField { + id: toLatitude + Layout.fillWidth: true + } + + Label { + id: label5 + text: qsTr("Longitude") + } + + TextField { + id: toLongitude + Layout.fillWidth: true + } + + RowLayout { + id: rowLayout1 + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignRight + Button { + id: goButton + text: qsTr("Proceed") + } + + Button { + id: clearButton + text: qsTr("Clear") + } + + Button { + id: cancelButton + text: qsTr("Cancel") + } + } + Item { + Layout.fillHeight: true + Layout.columnSpan: 2 + } + } + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/RouteList.qml b/examples/location/mapviewer/MapViewer/forms/RouteList.qml new file mode 100644 index 000000000..8dbda7c01 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteList.qml @@ -0,0 +1,50 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import "../helper.js" as Helper + +//! [routeinfomodel0] +ListView { +//! [routeinfomodel0] + property variant routeModel + property string totalTravelTime + property string totalDistance + signal closeForm() +//! [routeinfomodel1] + interactive: true + model: ListModel { id: routeInfoModel } + header: RouteListHeader {} + delegate: RouteListDelegate{ + routeIndex.text: index + 1 + routeInstruction.text: instruction + routeDistance.text: distance + } +//! [routeinfomodel1] + footer: Button { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Close") + onClicked: { + closeForm() + } + } + + Component.onCompleted: { + //! [routeinfomodel2] + routeInfoModel.clear() + if (routeModel.count > 0) { + for (var i = 0; i < routeModel.get(0).segments.length; i++) { + routeInfoModel.append({ + "instruction": routeModel.get(0).segments[i].maneuver.instructionText, + "distance": Helper.formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction) + }); + } + } + //! [routeinfomodel2] + totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime) + totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance) + } +//! [routeinfomodel3] +} +//! [routeinfomodel3] diff --git a/examples/location/mapviewer/MapViewer/forms/RouteListDelegate.qml b/examples/location/mapviewer/MapViewer/forms/RouteListDelegate.qml new file mode 100644 index 000000000..680318ac3 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteListDelegate.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + id: root + property bool checked: false + property alias routeInstruction: instructionLabel + property alias routeDistance: distanceLabel + property alias routeIndex: indexLabel + + width: appWindow.width + height: indexLabel.height * 2 + + RowLayout { + spacing: 10 + anchors.left: parent.left + anchors.leftMargin: 30 + anchors.verticalCenter: parent.verticalCenter + Label { + id: indexLabel + } + Label { + id: instructionLabel + wrapMode: Text.Wrap + } + Label { + id: distanceLabel + } + } + + Rectangle { + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 15 + height: 1 + color: "#46a2da" + } +} diff --git a/examples/location/mapviewer/MapViewer/forms/RouteListHeader.qml b/examples/location/mapviewer/MapViewer/forms/RouteListHeader.qml new file mode 100644 index 000000000..4f8308091 --- /dev/null +++ b/examples/location/mapviewer/MapViewer/forms/RouteListHeader.qml @@ -0,0 +1,47 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +Item { + property alias travelTime: travelTimeLabel + property alias distance: distanceLabel + width: parent.width + height: tabTitle.height * 3.0 + + Rectangle { + id: tabRectangle + y: tabTitle.height + height: tabTitle.height * 2 - 1 + color: "#46a2da" + anchors.left: parent.left + anchors.right: parent.right + + Label { + id: tabTitle + color: "#ffffff" + text: qsTr("Route Information") + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + Label { + id: travelTimeLabel + text: totalTravelTime + color: "#ffffff" + font.bold: true + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + } + + Label { + id: distanceLabel + text: totalDistance + color: "#ffffff" + font.bold: true + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } +} |