C

Q3DSElement Class

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

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

Q3DSSceneElement

Properties

  • 1 property inherited from QObject

Public Functions

Q3DSElement(Q3DSPresentation *presentation, const QString &elementPath, QObject *parent = nullptr)
virtual ~Q3DSElement()
QString elementPath() const
  • 34 public functions inherited from QObject

Public Slots

void fireEvent(const QString &eventName)
QVariant getAttribute(const QString &attributeName) const
void setAttribute(const QString &attributeName, const QVariant &value)
void setElementPath(const QString &elementPath)
  • 1 public slot inherited from QObject

Signals

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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

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.

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

See also Q3DSPresentation, Q3DSWidget, 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 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.

Access functions:

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

Notifier signal:

void elementPathChanged()

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] QVariant Q3DSElement::getAttribute(const QString &attributeName) const

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

The attributeName is the scripting name of the attribute.

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

Available under certain Qt licenses.
Find out more.