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:


This class was introduced in Qt 3D Studio 2.0.


Public Functions

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

Public Slots

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


void elementPathChanged(const QString &elementPath)

Detailed Description

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.

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

[virtual] Q3DSElement::~Q3DSElement()


Available under certain Qt licenses.
Find out more.