- Qt 6.11
- Qt Quick 3D
- QML Types
- InstanceList
- Qt Quick 3D | Commercial or GPLv3

# InstanceList QML Type

Allows manually specifying instancing in QML. More...

Import Statement: | `import QtQuick3D`
Inherits: | Instancing

- List of all members, including inherited members

## Properties

- instanceCount : int `(since 6.3)`
- instances : List<QtQuick3D::InstanceListEntry>

## Detailed Description

The InstanceList type makes it possible to define an instance table manually in QML.

The following example creates an instance table with two items:

     InstanceList {
         id: manualInstancing
         instances: [
             InstanceListEntry {
                 position: Qt.vector3d(0, 0, -60)
                 eulerRotation: Qt.vector3d(-10, 0, 30)
                 color: "red"
             },
             InstanceListEntry {
                 position: Qt.vector3d(50, 10, 100)
                 eulerRotation: Qt.vector3d(0, 180, 0)
                 color: "green"
             }
         ]
     }

It is also possible to populate the instances property by just adding children to the InstanceList. The following example is equivalent to the previous one:

     InstanceList {
         id: manualInstancing
         InstanceListEntry {
             position: Qt.vector3d(0, 0, -60)
             eulerRotation: Qt.vector3d(-10, 0, 30)
             color: "red"
         }
         InstanceListEntry {
             position: Qt.vector3d(50, 10, 100)
             eulerRotation: Qt.vector3d(0, 180, 0)
             color: "green"
         }
     }

Each InstanceListEntry is an object that can have property bindings and animations. This gives great flexibility, but also causes memory overhead. Therefore, it is not recommended to use InstanceList for procedurally generated tables containing thousands (or millions) of instances. Also, any property change to an entry will cause the entire instance table to be recalculated and uploaded to the GPU.

See also RandomInstancing and QQuick3DInstancing.

## Property Documentation

### instanceCount : int `[since 6.3]`

This read-only property contains the number of instances in the list.

This property was introduced in Qt 6.3.

### instances : List<QtQuick3D::InstanceListEntry> `[default]`

This property contains the list of instance definitions. Modifying this list, or any of its elements, will cause the instance table to be updated.