- Qt 6.10
- Qt Location
- QML Types
- MapItemView
- Qt 6.10.3 Reference Documentation

# MapItemView QML Type

The MapItemView is used to populate Map from a model. More...

Import Statement: | `import QtLocation 6.10`
Since: | QtLocation 5.5
Inherits: | QtObject

- List of all members, including inherited members
- MapItemView is part of QML Maps Plugin.

## Properties

- add : Transition `(since QtLocation 5.12)`
- autoFitViewport : bool
- delegate : Component
- delegateModelAccess : enumeration `(since 6.10)`
- model : model
- remove : Transition `(since QtLocation 5.12)`

## Detailed Description

The MapItemView is used to populate Map with MapItems from a model. The MapItemView type only makes sense when contained in a Map, meaning that it has no standalone presentation.

### Example Usage

This example demonstrates how to use the MapViewItem object to display a route on a map:

     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
             }
         }
     }

## Property Documentation

add : Transition `[since QtLocation 5.12]`

This property holds the transition that is applied to the map items created by the view when they are instantiated and added to the map.

This property was introduced in QtLocation 5.12.

autoFitViewport : bool

This property controls whether to automatically pan and zoom the viewport to display all map items when items are added or removed.

Defaults to false.

delegate : Component

This property holds the delegate which defines how each item in the model should be displayed. The Component must contain exactly one MapItem -derived object as the root object.

delegateModelAccess : enumeration `[since 6.10]`

This property determines how delegates can access the model.

Constant | Description
--- | ---
`DelegateModel.ReadOnly` | Prohibit delegates from writing the model via either context properties, the `model` object, or required properties.
`DelegateModel.ReadWrite` | Allow delegates to write the model via either context properties, the `model` object, or required properties.
`DelegateModel.Qt5ReadWrite` | Allow delegates to write the model via the `model` object and context properties but not via required properties.

The default is `DelegateModel.Qt5ReadWrite`.

This property was introduced in Qt 6.10.

See also Models and Views in Qt Quick#Changing Model Data.

model : model

This property holds the model that provides data used for creating the map items defined by the delegate. Only QAbstractItemModel based models are supported.

remove : Transition `[since QtLocation 5.12]`

This property holds the transition that is applied to the map items created by the view when they are removed.

This property was introduced in QtLocation 5.12.