MapItemView QML Type

MapItemView 用于从模型中填充地图。更多

Import Statement: import QtLocation 6.9
Since: QtLocation 5.5
Inherits:

QtObject

属性

详细说明

MapItemView 用于用模型中的 MapItems 填充地图。MapItemView 类型只有在包含在地图中时才有意义,这意味着它没有独立的表现形式。

使用示例

本例演示了如何使用 MapViewItem 对象在map 上显示route

import QtQuick
import QtPositioning
import QtLocation

Map {
    RouteModel {
        id: routeModel
    }

    MapItemView {
        model: routeModel
        delegate: routeDelegate
    }

    Component {
        id: routeDelegate

        MapRoute {
            route: routeData
            line.color: "blue"
            line.width: 5
            smooth: true
            opacity: 0.8
        }
    }
}

属性文档

add : Transition [since QtLocation 5.12]

该属性用于保存视图创建的地图项在实例化并添加到地图时所应用的转换。

该属性在 QtLocation 5.12 中引入。


autoFitViewport : bool

该属性控制在添加或删除项目时是否自动平移和缩放视口以显示所有地图项目。

默认为 false。


delegate : Component

该属性持有定义如何显示模型中每个项的委托。该组件的根对象必须正好包含一个 MapItem 派生对象。


model : model

该属性包含模型,该模型提供用于创建委托所定义的地图项的数据。只支持基于QAbstractItemModel 的模型。


remove : Transition [since QtLocation 5.12]

该属性保存视图创建的地图项被移除时所应用的转换。

该属性在 QtLocation 5.12 中引入。


© 2025 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.