Important: Please read the Qt Code of Conduct -

QML Map correct zoomLevel

  • Hi all,

    I'm new in Qt development. I'm using QML Map element ( Qt Mobility 1.1 QML plugin ) to show map on the device. Everything works as expected, but i have one issue which i don't know how to resolve it and might need some correct directions/possible solution.

    My problems is:
    I have a map and some MapCircles ( some circles are shown on some coordinates. I will change that probably to Landmarks later ). I want to set correct zoomLevel to the map so that all Circles ( points ) will be visible?? Is there any algorithm to calculate that? Any better approach/solution?

    In general: i just want to set corretct zoom level so that all landmarks/circles will be visible. Maybe is there tottally different approach to achive that?

    Many thanks for any directions/help!


  • Hi,

    I don't think there's a function available to do this using QML. At least in QtM 1.1 there wasn't. The C++ API has QGraphicsGeoMap::fitInViewport(). You can pass this method a bounding box and it will try zooming to fit the box into the viewport.

    Not sure that will help you, but it's all I'm currently aware of.

Log in to reply