Important: Please read the Qt Code of Conduct -

problem with QML and Google Maps Plugin

  • Hi all,

    I need to have google maps satellite view using qml. I have built the plugin created by @vladstelmahovsky and i got it working in debug mode, but when i switch to release mode the google map is not shown but the other part of the qml are visible.
    The following image can help you understand:


    This is the code:

    import QtQuick 2.7
    import QtQuick.Controls 1.4
    import QtQuick.Window 2.0
    import QtLocation 5.6
    import QtPositioning 5.6
    Rectangle {
        id: mainWindow
        width: 512
        height: 512
        visible: true
            ListElement {
                Latitude: 47.212047
                Longitude: -1.551647
                Label: "something"
                Orientation: 0
        Plugin {
            id: googleMaps
            name: "googlemaps" // "mapboxgl", "esri", ...
            // specify plugin parameters if necessary
             PluginParameter {
        Map {
            id: myMap
            anchors.fill: parent
            plugin: googleMaps
            activeMapType: supportedMapTypes[1]
            center: QtPositioning.coordinate(59.91, 10.75) // Oslo
            zoomLevel: 14
                model: dummyModel
                delegate: MapQuickItem {
                    coordinate: QtPositioning.coordinate(Latitude,Longitude)
                    sourceItem:  Text{
                        width: 100
                        height: 50
                        text: model.Label
                        rotation: model.Orientation
                        opacity: 0.6
                        color: model.Color
            MapPolyline {
                    line.width: 3
                    line.color: 'green'
                    path: [
                        { latitude: 59.92, longitude: 10.77 },
                        { latitude: 59.96, longitude: 10.78 },
                        { latitude: 59.99, longitude: 10.76 },
                        { latitude: 59.95, longitude: 10.74 }
            MapCircle {
              //a static item (fixed real dimension) always at 100m east of the map center
        MouseArea {
               anchors.fill: parent
               acceptedButtons:  Qt.RightButton
               onClicked: {
                    if (mouse.button === Qt.RightButton)
                            "Latitude": myMap.toCoordinate(Qt.point(mouseX,mouseY)).latitude ,"Longitude": myMap.toCoordinate(Qt.point(mouseX,mouseY)).longitude ,
                            "Label": "abc" , "Color": "red",
                            "Orientation":Number(3), })
            text:"Click to add name"
            onClicked: {
                if(buttonMap.text == "Click to add name")
                    buttonMap.text = "Click to cancel name"
                    myMap.activeMapType = myMap.supportedMapTypes[3]
                    buttonMap.text = "Click to add name"
                    myMap.activeMapType = myMap.supportedMapTypes[1]
               title:"map types"
                   onCurrentIndexChanged: myMap.activeMapType = myMap.supportedMapTypes[/*currentIndex*/0]

    When i try to change the MapType in the application output it appears thi message:

    qrc:/qml/qml/MapTrack.qml:119: Error: Cannot assign [undefined] to QDeclarativeGeoMapType*

    Somebody can give me some hint? I really don't know how to get it work also in release mode.

    Thanks in advance.

  • @davidesalvetti I suppose, you have to build and install plugin in both debug and release modes. its very depends how exactly you building the plugin.

  • @vladstelmahovsky Thank you very much, this was the answer! how stupid I was, I thought I had problem on my code side.
    Thank you again, now It works correctly also in release mode!

  • Guys, which plugin you talked about?
    I looked into Qt source code but I couldn't find any Google Maps plugin!

    I only found 5 plugins for Qt Location while Google Maps isn't one of them!

  • source :

    Google TOS do not permit [Qt] to offer a Google specific geoservices plugin.

  • @VRonin said in problem with QML and Google Maps Plugin:

    source :

    Google TOS do not permit [Qt] to offer a Google specific geoservices plugin.

    But how @davidesalvetti use it?

  • @tansgumus said in problem with QML and Google Maps Plugin:

    But how @davidesalvetti use it?

    @davidesalvetti said in problem with QML and Google Maps Plugin:

    I have built the plugin created by @vladstelmahovsky

    That's a 3rd party library hosted here:

  • @VRonin Shame on you Google

Log in to reply