google maps in qt
-
Hi,
There's also a forum member that has implemented a backend for it. See this thread
-
wrote on 26 Apr 2016, 10:07 last edited by
@saitej Don't know what you want to do, just as a reminder: "Currently it is not possible to interact with maps via C++".
-
@saitej Don't know what you want to do, just as a reminder: "Currently it is not possible to interact with maps via C++".
wrote on 26 Apr 2016, 10:19 last edited by@Wieland
Hi ..
I want to display the current location as the first step using the googlemaps plugin either in qml or c++ which ever is possible. -
@Wieland
Hi ..
I want to display the current location as the first step using the googlemaps plugin either in qml or c++ which ever is possible.wrote on 26 Apr 2016, 10:25 last edited by -
wrote on 27 Apr 2016, 06:17 last edited by
@Wieland
I tried the code from the link you had sent but am unable to view any map.
This is my main.qml code. The code doesn’t give an error but displays a blank window.import QtPositioning 5.5 import QtLocation 5.6 import QtQuick 2.6 import QtQuick.Window 2.2 Window { visible: true width: 400 height: 600 MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } Plugin{ id:myplugin name: "osm" } Map { id: map plugin: myplugin center { latitude: -27 longitude: 153 } zoomLevel: map.minimumZoomLevel gesture.enabled: true } }
-
wrote on 27 Apr 2016, 07:00 last edited by
In my case, I used the API QMapControl Under LGPL license.
It's very easy to use. -
@Wieland
I tried the code from the link you had sent but am unable to view any map.
This is my main.qml code. The code doesn’t give an error but displays a blank window.import QtPositioning 5.5 import QtLocation 5.6 import QtQuick 2.6 import QtQuick.Window 2.2 Window { visible: true width: 400 height: 600 MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } Plugin{ id:myplugin name: "osm" } Map { id: map plugin: myplugin center { latitude: -27 longitude: 153 } zoomLevel: map.minimumZoomLevel gesture.enabled: true } }
wrote on 27 Apr 2016, 09:27 last edited by@saitej Add
anchors.fill: contentItem
to your Map item ;-) -
wrote on 1 May 2016, 05:58 last edited by
Hi
I am having few basic issues with this code. I am unable to display the marker on the map.
Also, where do I write the signal showRoute(startCoordinate,endCoordinate)
It's giving me already declared errorI am used to c++ and I just started to use qml. so the doubts will be pretty basic so please bear with me
import QtPositioning 5.5 import QtLocation 5.6 import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 Window { visible: true width: 400 height: 600 MouseArea { anchors.fill: parent // onClicked: { // Qt.quit(); // } } // splitview SplitView { anchors.fill: parent orientation: Qt.Vertical //rect1 Rectangle { height: 150 Layout.maximumHeight: 200 // color: "lightblue" Label { id: label1 text: "Latitude Start" x:0 y:2 } Label{ id : label2 text: "Longitude Start" x:0 y:25 } Label { id: label3 text: "Latitude End" x:0 y:50 } Label{ id : label4 text: "Longitude End" x:0 y:75 } // textinputs TextInput { // anchors.fill: id: input1 x:150 y:2 font.pixelSize: 12; font.bold: false cursorVisible: true text: "12.9716" // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } focus:true } TextInput { // anchors.fill: contentItem id: input2 x:150 y:25 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "77.5946" } TextInput { // anchors.fill: contentItem id: input3 x:150 y:50 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "19.0760" } TextInput { // anchors.fill: contentItem id: input4 x:150 y:75 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "72.8777" } Button{ id:goButton text : "GO!" anchors.horizontalCenter: parent.horizontalCenter y: 100 onClicked: { var startCoordinate = QtPositioning.coordinate(parseFloat(input1.text), parseFloat(input2.text)); var endCoordinate = QtPositioning.coordinate(parseFloat(input3.text), parseFloat(input4.text)); if (startCoordinate.isValid && endCoordinate.isValid) { goButton.enabled = false; showRoute(startCoordinate,endCoordinate) } } } Plugin{ id:myplugin name: "osm" } } //rectangle ends here Map { id: map plugin: myplugin center { // latitude: 12.9716 // // longitude: 77.5946 // latitude :input1.text longitude:input2.text } zoomLevel: 13 anchors.fill: contentItem gesture.enabled: true // property variant location: QtPositioning.coordinate( input1.text, input2.text) MapItemView { model:PlaceSearchModel delegate: MapQuickItem { id : marker coordinate: QtPositioning.coordinate( input1.text, input2.text) anchorPoint.x: image.width * 0.5 anchorPoint.y: image.height sourceItem: Image { id: image source: "qrc:/marker.png" } } } } } }
-
Hi
I am having few basic issues with this code. I am unable to display the marker on the map.
Also, where do I write the signal showRoute(startCoordinate,endCoordinate)
It's giving me already declared errorI am used to c++ and I just started to use qml. so the doubts will be pretty basic so please bear with me
import QtPositioning 5.5 import QtLocation 5.6 import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 Window { visible: true width: 400 height: 600 MouseArea { anchors.fill: parent // onClicked: { // Qt.quit(); // } } // splitview SplitView { anchors.fill: parent orientation: Qt.Vertical //rect1 Rectangle { height: 150 Layout.maximumHeight: 200 // color: "lightblue" Label { id: label1 text: "Latitude Start" x:0 y:2 } Label{ id : label2 text: "Longitude Start" x:0 y:25 } Label { id: label3 text: "Latitude End" x:0 y:50 } Label{ id : label4 text: "Longitude End" x:0 y:75 } // textinputs TextInput { // anchors.fill: id: input1 x:150 y:2 font.pixelSize: 12; font.bold: false cursorVisible: true text: "12.9716" // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } focus:true } TextInput { // anchors.fill: contentItem id: input2 x:150 y:25 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "77.5946" } TextInput { // anchors.fill: contentItem id: input3 x:150 y:50 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "19.0760" } TextInput { // anchors.fill: contentItem id: input4 x:150 y:75 font.pixelSize: 12; font.bold: false // acceptableInput: validator : RegExpValidator { regExp : /[0-9]+\.[0-9]+/ } // focus:true echoMode: TextInput.Normal activeFocusOnTab: true text: "72.8777" } Button{ id:goButton text : "GO!" anchors.horizontalCenter: parent.horizontalCenter y: 100 onClicked: { var startCoordinate = QtPositioning.coordinate(parseFloat(input1.text), parseFloat(input2.text)); var endCoordinate = QtPositioning.coordinate(parseFloat(input3.text), parseFloat(input4.text)); if (startCoordinate.isValid && endCoordinate.isValid) { goButton.enabled = false; showRoute(startCoordinate,endCoordinate) } } } Plugin{ id:myplugin name: "osm" } } //rectangle ends here Map { id: map plugin: myplugin center { // latitude: 12.9716 // // longitude: 77.5946 // latitude :input1.text longitude:input2.text } zoomLevel: 13 anchors.fill: contentItem gesture.enabled: true // property variant location: QtPositioning.coordinate( input1.text, input2.text) MapItemView { model:PlaceSearchModel delegate: MapQuickItem { id : marker coordinate: QtPositioning.coordinate( input1.text, input2.text) anchorPoint.x: image.width * 0.5 anchorPoint.y: image.height sourceItem: Image { id: image source: "qrc:/marker.png" } } } } } }
-
wrote on 30 Aug 2017, 03:04 last edited by
QWebView::load