Element QML Type | Qt 3D Studio Runtime 2.0

Qt 3D Studio Runtime | QML Types | Element QML Type

Qt 3D Studio Runtime 2.0 Manual

# Element QML Type

Control type for elements in a Qt 3D Studio presentation. More...

Import Statement: | import .
Instantiates: | Q3DSElement
Inherited By: | SceneElement

- List of all members, including inherited members

## Properties

- elementPath : string

## Methods

- void fireEvent(string eventName)
- variant getAttribute(string attributeName)
- void setAttribute(string attributeName, variant value)

## Detailed Description

This type is a convenience for controlling the properties of a scene object (such as, model, material, camera, layer) in a Qt 3D Studio presentation.

Note: The functionality of Element is equivalent to Presentation::setAttribute(), Presentation::getAttribute() and Presentation::fireEvent().

See also Studio3D, Presentation, and SceneElement.

## Property Documentation

elementPath : string

Holds the element path of the presentation element.

An element path refers to an object in the scene either by name or id. The latter is rarely used in application code since the unique IDs are not exposed in the Qt 3D Studio application. To refer to an object by id, prepend `#` to the name. Applications will typically refer to objects by name.

Names are not necessarily unique, however. To access an object with a non-unique name, the path can be specified, for example, `Scene.Layer.Camera`. Here the right camera object gets chosen even if the scene contains other layers with the default camera names (for instance `Scene.Layer2.Camera`).

If the object is renamed to a unique name in the Qt 3D Studio application's Timeline view, the path can be omitted. For example, if the camera in question was renamed to `MyCamera`, applications can then simply pass `MyCamera` as the element path.

To access an object in a sub-presentation, prepend the name of the sub-presentation followed by a colon, for example, `SubPresentationOne:Scene.Layer.Camera`.

## Method Documentation

void fireEvent(string eventName)

Dispatches an event with eventName on the scene object specified by elementPath.

Appropriate actions created in Qt 3D Studio or callbacks registered using the registerForEvent() method in attached `behavior scripts` will be executed in response to the event.

variant getAttribute(string attributeName)

Returns the current value of an attribute (property) of the scene object specified by this Element instance. The attributeName is the scripting name of the attribute.

void setAttribute(string attributeName, variant value)

Sets the value of an attribute (property) of the scene object specified by this Element instance. The attributeName is the scripting name of the attribute.