Reputation: 11
I'm new to Qt and i'm starting a new GUI using QML.
I have a map and i want to display a marker. But i'm not able to display the marker using a MapQuickItem.
In my code below the title, the map and the MapCircle are displayed correctly, but the MapQuickItem is not displayed.
The image "marker.png" exists and i'm able to display it.
Thanks for your help.
import QtQuick 2.0 import QtLocation 5.6 import QtPositioning 5.6 import "../items" SimpleTile { m_width : 300 m_height : 300 property double m_latitude; property double m_longitude; innerObject: Column { id: colMap anchors.fill: parent Plugin { id: mapPlugin name: "esri" } Text { id: title width: colMap.width height: 25 horizontalAlignment: TextInput.AlignHCenter font.bold: true font.pointSize: 15 text: "Position" } Map { id: map width: colMap.width height: parent.height - title.height plugin: mapPlugin center: QtPositioning.coordinate(m_latitude, m_longitude) zoomLevel: 14 MapQuickItem { id: marker anchorPoint.x: image.width/2 anchorPoint.y: image.height coordinate { latitude: m_latitude longitude: m_longitude } sourceItem: Image { id: image; source: "qrc:/images/marker.png" } } MapCircle { radius: 1000 color: "red" opacity: 0.4 center { latitude: m_latitude longitude: m_longitude } } } } }
Upvotes: 0
Views: 1473
Reputation: 11
Ok, I solve my problem by changing
... MapQuickItem { ... coordinate { latitude: m_latitude longitude: m_longitude } ...
to
... MapQuickItem { ... coordinate: QtPositioning.coordinate(m_latitude, m_longitude) ...
Thanks for your answers.
Upvotes: 1