Skip to content

Latest commit

 

History

History
136 lines (91 loc) · 3.13 KB

ObjectArray.rst

File metadata and controls

136 lines (91 loc) · 3.13 KB

ObjectArray

Description

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

› Inherits

Object <object_Object>

› Inherited by

Application <object_Application>

Overview

Properties

  • objects <property_ObjectArray_objects>
  • Object.objectId <property_Object_objectId>
  • Object.parent <property_Object_parent>

Methods

  • Object.deserializeProperties() <method_Object_deserializeProperties>
  • Object.fromJson() <method_Object_fromJson>
  • Object.serializeProperties() <method_Object_serializeProperties>
  • Object.toJson() <method_Object_toJson>

Signals

  • objectsDataChanged() <signal_ObjectArray_objectsDataChanged>
  • Object.completed() <signal_Object_completed>

Properties

single: objects

objects

This property holds a list of Object <object_Object> instances.

› Type

List <object_List><Object <object_Object>>

› Signal

objectsChanged()

› Attributes

Readonly

Signals

single: objectsDataChanged

objectsDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() <signal_List_dataChanged> signal is emitted, i.e. the item at index in the objects <property_ObjectArray_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" )
    }

}