RouteAddressForm {
property alias plugin : tempGeocodeModel.plugin;
- property variant fromAddress;
property variant toAddress;
+ property variant fromCoordinate;
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.startCoordinate = fromCoordinate
tempGeocodeModel.endCoordinate = QtPositioning.coordinate()
- tempGeocodeModel.query = fromAddress
+ tempGeocodeModel.query = fromCoordinate
tempGeocodeModel.update();
goButton.enabled = false;
}
clearButton.onClicked: {
- fromStreet.text = ""
- fromCity.text = ""
- fromCountry.text = ""
toStreet.text = ""
toCity.text = ""
toCountry.text = ""
}
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
}
onStatusChanged: {
- if ((status == GeocodeModel.Ready) && (count == 1)) {
+ if ((status == GeocodeModel.Ready) && count >= 1) {
success++
if (success == 1) {
startCoordinate.latitude = get(0).coordinate.latitude
import QtQuick.Layouts 1.2
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
columns: 2
anchors.fill: parent
- Label {
- id: label1
- text: qsTr("From")
- font.bold: true
- anchors.horizontalCenter: parent.horizontalCenter
- Layout.columnSpan : 2
- }
-
- 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")
stackView.push(Qt.resolvedUrl("../forms/RouteAddress.qml"),
{ "plugin": map.plugin,
"toAddress": toAddress,
- "fromAddress": fromAddress})
+ "fromCoordinate": map.location})
stackView.currentItem.showRoute.connect(map.calculateCoordinateRoute)
stackView.currentItem.showMessage.connect(stackView.showMessage)
stackView.currentItem.closeForm.connect(stackView.closeForm)