Unsolved How send edit field values to variable, draw way between 2 points
-
Hi,
On the begin I wanna to say, sorry for my bad english.I have a little problem withh qml. I'm doing just now a little navigation. Hier is the code
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Window 2.0 import QtLocation 5.6 import QtPositioning 5.6 ApplicationWindow { id: app_window visible: true width: 1024 height: 800 title: qsTr("Navigation") Plugin { id: mapPlugin name: "osm" } Rectangle { id: mapRectangleID width: 500 height: 500 anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter Map { id: map anchors.fill: parent plugin: mapPlugin center { latitude: 59.91//länge longitude: 10.75//breite } zoomLevel: 14 //******************************START POINT******************************// MapCircle { id: startPointCircle center { latitude: 59.91 longitude: 10.75 } radius: 100000.0 color: 'green' border.width: 3 } //******************************FINISH POINT******************************// MapCircle { id: endPointCircle center { latitude: 51.20 longitude: 12.22 } radius: 100000.0 color: 'red' border.width: 3 } }// Map } //Rectangle //******************************START POINT INPUT FIELD BREITE******************************// Rectangle{ id:_ifStartingPoint width: 100 height: 20 border.color: 'gray' border.width: 2 x: 900 y: 100 anchors.left: app_window.right TextInput { id: txtPlainStartPointLatitude anchors.fill: parent anchors.margins: 4 } } //******************************END POINT INPUT FIELD LAENGE******************************// Rectangle{ id:_ifEndPoint width: 100 height: 20 border.color: 'gray' border.width: 2 x: 900 y: 150 anchors.left: app_window.right TextInput { id: txtPlainStartPointLongitude anchors.fill: parent anchors.margins: 4 } } Button { text: "Zeige den weg" x: 900; y: 200 onClicked: { // map.Longitude = txtPlainStartPointLatitude.Text center: QtPositioning.coordinate(latitude= txtPlainStartPointLatitude.Text, longitude= txtPlainStartPointLatitude.Text) } } PositionSource { nmeaSource: "socket://127.0.0.1:12345" } }
So I have 2 input fields, where the user can write the latitude and longitude, but i don't know, how i can use this values and send to a variable or use hier
//******************************START POINT******************************// MapCircle { id: startPointCircle center { latitude: 59.91 longitude: 10.75 } radius: 100000.0 color: 'green' border.width: 3 }
I tried so:
//******************************START POINT******************************// MapCircle { id: startPointCircle center { latitude: txtPlainStartPointLatitude longitude: txtPlainStartPointLongitude } radius: 100000.0 color: 'green' border.width: 3 }
But it doesn't work, have someone any ideas?
And second problem, I have two point, but i don't know, how i can draw a way by using openstreet maps, between 2 points. Can i do that only by qml, or i need python or js? And have someone any links to tutorials, how i can do that?
Thanks for your help and have a nice day
DragonCoder -
Hi,
tryonClicked: { map.center = QtPositioning.coordinate(parseFloat(txtPlainStartPointLatitude.text),parseFloat(txtPlainStartPointLongitude.text)) }
-
@LeLev said in How send edit field values to variable, draw way between 2 points:
Hi,
tryonClicked: { map.center = QtPositioning.coordinate(parseFloat(txtPlainStartPointLatitude.text),parseFloat(txtPlainStartPointLongitude.text)) }
It's helped to do a circle on start and end point. Do you know, how i can draw between point A and B, i'm using OpenStreet Maps
-