qmlqt5.7

QML Map.center trouble in QT5.7


I tried to upgrade Qt 5.6 project up to 5.7 and got some trouble with QML Map. I have a simple project with such code:

Plugin {
    id: myPlugin
    name: "osm"
    PluginParameter {
        name: "osm.mapping.host";
        value: "http://a.tile.openstreetmap.org/"
    }
}

Map {
    id: map
    anchors.fill: parent
    plugin: myPlugin;
    center: QtPositioning.coordinate(55.7512, 37.6175)
    zoomLevel: 12
    activeMapType: map.supportedMapTypes[6] //some magic to work
}

It works in 5.6 - I have all spots on a map which I define as QtPositioning.coordinate(). And it works in 5.7 too - with all my spots, except one thing - in 5.7 my map starts in the middle of Africa instead of coordinates I pointed at Map.center.

I tried running example from QtCreator - it had the same problem. So, I'd be glad to any advice.


Solution

  • I've tried to set Map.center in 2 different ways:

    1.

    Map {
        center: QtPositioning.coordinate(55.7512, 37.6175)
        Component.onCompleted: {
            console.log(map.center);
        }
    }
    

    The output was:

    qml: 0° 0' 0.0", 37° 37' 3.0" E

    It looks that assigning coordinates in this way ignores latitude.

    2.

     Map {
        center {
            latitude: 55.7512
            longitude: 37.6175
        }
        Component.onCompleted: {
            console.log(map.center);
        }
    }
    

    The output was:

    qml: 55° 45' 4.3" N, 37° 37' 3.0" E

    So assigning coordinates in this way works w/o problems.

    As for me it looks like a bug. I've created a bug report here.