Object

Properties

objectId

This property holds an optional ID for the object in case the object does not have an QML ID assigned. Like the QML ID the object ID should be a simple string with alphanumeric characters only.

› Type:String
› Signal:objectIdChanged()
› Attributes:Writable

parent

This property holds a reference to the current parent of the object.

› Type:Object
› Signal:parentChanged()
› Attributes:Writable

Methods

deserializeProperties(Map variantMap)

This method deserializes (loads) the corresponding properties of this object instance and children objects. It works similarly to fromJson() but takes a map/dictionary instead of a JSON string.

This method was introduced in InCore 2.4.

fromJson(String data)

This method parses the specified JSON string and deserializes (loads) the corresponding properties of this object instance and children objects.

serializeProperties(Object.SerializeFilter filter)

This method serializes (saves) the corresponding properties of this object instance and children objects. It works similarly to toJson() but returns a map/dictionary instead of a JSON string.

This method was introduced in InCore 2.5.

› Returns:Map

toJson(JSValue jsValue)

This method returns a JSON representation of all properties of this instance and all children objects if no argument is passed. If the argument is a property or a JavaScript value (object, array etc.) it is converted to a human-readable JSON string. This allows dumping complex data structures easily while debugging. When requiring additional control over how and which properties are to be serialized, Serializer should be used instead.

› Returns:String

Signals

completed()

This signal is emitted when the object and all its children objects have been loaded and initialized completely. A handler for this signal can be used to start certain operations such as opening a resource, initiating a connection or logging the successful initialization.

Note

Most operational objects provide properties for automatically starting their operation and should be used instead of calling the corresponding methods manually in a handler of this signal.

Example

import InCore.Foundation 2.5

Application {

    Object {
        objectId: "testObject"
        property string foo: "bar"
        onCompleted: {
            console.log("Hello world, I'm", objectId, "and my vendor is", parent.vendor)
            console.log("My JSON representation is", toJson())
        }
    }
}