Q3DSElement Class | OpenGL Runtime 2.8.0

- OpenGL Runtime
- OpenGL Runtime
- C++ Classes
- Q3DSElement
- Qt 3D Studio OpenGL Runtime 2.8 Manual

# Q3DSElement Class

Controls a scene object (element) in a Qt 3D Studio presentation. More...

Header: | #include <Q3DSElement>
Since: | Qt 3D Studio 2.0
Instantiated By: | Element
Inherits: | QObject
Inherited By: | Q3DSSceneElement

- List of all members, including inherited members
- Obsolete members

## Properties

- elementPath : QString

- 1 property inherited from QObject

## Public Functions

| Q3DSElement(Q3DSPresentation *presentation, const QString &elementPath, QObject *parent = nullptr)
virtual | ~Q3DSElement()
QString | elementPath() const

- 31 public functions inherited from QObject

## Public Slots

void | fireEvent(const QString &eventName)
void | setAttribute(const QString &attributeName, const QVariant &value)
void | setElementPath(const QString &elementPath)

- 1 public slot inherited from QObject

## Signals

void | elementPathChanged(const QString &elementPath)

- 2 signals inherited from QObject

## Static Public Members

const QMetaObject | staticMetaObject

- 9 static public members inherited from QObject

## Protected Variables

Q3DSElementPrivate * | d_ptr

### Additional Inherited Members

- 9 protected functions inherited from QObject

## Detailed Description

Controls a scene object (element) in a Qt 3D Studio presentation.

This class is provided for backwards compatibility. We recommend using DataInput and DataOutput APIs for contractual and clean API between the design and the code.

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

See also Q3DSSurfaceViewer and Q3DSSceneElement.

## Property Documentation

### elementPath : QString

Holds the element path of the presentation element.

An element path refers to an object in the scene by name, 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`).

To reference an object stored in a property of another object, the dot syntax can be used. The most typical example of this is changing the source of a texture map by changing the `sourcepath` property on the object selected by `SomeMaterial.diffusemap`.

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`.

Access functions:

QString | elementPath() const
void | setElementPath(const QString &elementPath)

Notifier signal:

void | elementPathChanged(const QString &elementPath)

## Member Function Documentation

### Q3DSElement::Q3DSElement(Q3DSPresentation *presentation, const QString &elementPath, QObject *parent = nullptr)

Constructs a Q3DSElement instance controlling the scene object specified by elementPath. An optional parent object can be specified. The constructed instance is automatically associated with the specified presentation. An optional parent object can be specified.

### `[virtual]` Q3DSElement::~Q3DSElement()

Destructor.

### `[slot]` void Q3DSElement::fireEvent(const QString &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.

### `[slot]` void Q3DSElement::setAttribute(const QString &attributeName, const QVariant &value)

Sets the value of an attribute (property) of the scene object specified by elementPath.

The attributeName is the scripting name of the attribute.