Nesta página

Qt Location Plugin de sobreposição de itens

Visão geral

Este plugin de serviços geográficos é um plugin especial que fornece apenas um mapa vazio. Ele não oferece nenhum serviço e destina-se a ser usado nos casos em que um elemento ` Map ` deve exibir apenas os itens de mapa adicionados.

O plugin de serviços geográficos “Items Overlay” pode ser carregado usando a chave de plugin “itemsoverlay”.

Exemplo de uso

O trecho a seguir mostra como um mapa que utiliza este plug-in pode ser adicionado como uma sobreposição para exibir itens do mapa com suavização de contornos. Observe que, para que esse mapa de sobreposição seja transparente, também é necessário definir sua cor como transparente, como no exemplo.

Window {
    id: win
    visible: true
    width: 640
    height: 640

    Map {
        id: mapBase
        anchors.fill: parent
        plugin: Plugin { name: "osm" }
        center: QtPositioning.coordinate(45,10)
        zoomLevel: 4
        z: parent.z + 1
    }

    Map {
        id: mapOverlay
        anchors.fill: parent
        plugin: Plugin { name: "itemsoverlay" }
        center: mapBase.center
        color: 'transparent' // Necessary to make this map transparent
        minimumFieldOfView: mapBase.minimumFieldOfView
        maximumFieldOfView: mapBase.maximumFieldOfView
        minimumTilt: mapBase.minimumTilt
        maximumTilt: mapBase.maximumTilt
        minimumZoomLevel: mapBase.minimumZoomLevel
        maximumZoomLevel: mapBase.maximumZoomLevel
        zoomLevel: mapBase.zoomLevel
        tilt: mapBase.tilt;
        bearing: mapBase.bearing
        fieldOfView: mapBase.fieldOfView
        z: mapBase.z + 1

        MapCircle {
            id: circle
            center: QtPositioning.coordinate(44, 10)
            radius: 200000
            border.width: 5

            MouseArea {
                anchors.fill: parent
                drag.target: parent
            }
        }

        // The code below enables SSAA
        layer.enabled: true
        layer.smooth: true
        property int w : mapOverlay.width
        property int h : mapOverlay.height
        property int pr: Screen.devicePixelRatio
        layer.textureSize: Qt.size(w  * 2 * pr, h * 2 * pr)
    }
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.