ObjectArray

Description

The ObjectArray object provides a container to group Object instances. This can be useful e.g. when Gather is used to merge multiple lists or object hierarchies.

› Inherits:Object
› Inherited by:Application

Properties

objects

This property holds a list of Object instances.

› Type:List<Object>
› Signal:objectsChanged()
› Attributes:Readonly

Signals

objectsDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the objects list itself emitted the dataChanged() signal.

Example

import InCore.Foundation 2.5

Application {

    // Object Array with fixed elements - the usual way
    ObjectArray {
        id: objectArrayA
        Measurement {
            id: meas0
        }
        Measurement {
            id: meas1
        }
        onCompleted: console.log( "ObjectArray A ready with", objects.length, "objects" )
    }

    // ObjectArray with dynamic objects
    ObjectArray {
        id: objectArrayB
        Repeater on objects {
            model: 3
            Measurement {
                objectId: "id" + index
                data: index
            }
        }
        onObjectsChanged: console.log( "ObjectArray B has now", objects.length, "objects" )
    }

    // ObjectArray with elements of objectArrayA and objectArrayB
    ObjectArray {
        Gather on objects {
            source: ObjectArray {
                List { reference: objectArrayA.objects }
                List { reference: objectArrayB.objects }
            }
        }
        onObjectsChanged: console.log( "Combined list with", objects.length, "objects" )
    }

}