Q3DSDataInput Class | OpenGL Runtime 2.7.0

OpenGL Runtime | OpenGL Runtime | C++ Classes | Q3DSDataInput

Qt 3D Studio OpenGL Runtime 2.7 Manual

# Q3DSDataInput Class

Controls a data input entry in a Qt 3D Studio presentation. This class is a convenience class for controlling a data input in a presentation. DataInput provides a clean contract between the presentation design and the code. It hides the presentation details from the code while providing a contractual access point to code for controlling aspects of the presentation (e.g. timeline of a subpresentation). It also allows the design to use a single DataInput to drive multiple aspects of the design (e.g. DataInput for speed can change the color of the speedometer, angle of the needle). More...

Header: | #include <Q3DSDataInput>
Since: | Qt 3D Studio 2.0
Instantiated By: | DataInput
Inherits: | QObject

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

## Properties

- max : const float
- metadataKeys : const QStringList
- min : const float

- name : QString
- value : QVariant

- 1 property inherited from QObject

## Public Functions

| Q3DSDataInput(Q3DSPresentation *presentation, const QString &name, QObject *parent = nullptr)
virtual | ~Q3DSDataInput()
bool | isValid() const
float | max() const
QString | metadata(const QString &key) const
QStringList | metadataKeys() const
float | min() const
QString | name() const
QVariant | value() const

- 31 public functions inherited from QObject

## Public Slots

void | setName(const QString &name)
void | setValue(const QVariant &value, bool force = false)

- 1 public slot inherited from QObject

## Signals

void | nameChanged()
void | valueChanged()

- 2 signals inherited from QObject

## Static Public Members

const QMetaObject | staticMetaObject

- 9 static public members inherited from QObject

### Additional Inherited Members

- 9 protected functions inherited from QObject

## Detailed Description

Controls a data input entry in a Qt 3D Studio presentation. This class is a convenience class for controlling a data input in a presentation. DataInput provides a clean contract between the presentation design and the code. It hides the presentation details from the code while providing a contractual access point to code for controlling aspects of the presentation (e.g. timeline of a subpresentation). It also allows the design to use a single DataInput to drive multiple aspects of the design (e.g. DataInput for speed can change the color of the speedometer, angle of the needle).

Note: There is a performance cost for each registered DataInput, so try to avoid creating unnecessary DataInputs.

For other integration points between code and presentation see:

See also Q3DSPresentation::customSignalEmitted, Q3DSPresentation::slideEntered, Q3DSPresentation::slideExited, Q3DSDataOutput, and Q3DSPresentation.

## Property Documentation

### max : const float

Contains the maximum range value for datainput. Returned value is zero for datainput types other than Ranged Number.

Note: This value is read-only.

Access functions:

float | max() const

### metadataKeys : const QStringList

Contains the metadata keys specified for this datainput.

Note: This value is read-only.

Access functions:

QStringList | metadataKeys() const

### min : const float

Contains the minimum range value for datainput. Returned value is zero for datainput types other than Ranged Number.

Note: This value is read-only.

Access functions:

float | min() const

### name : QString

Specifies the name of the controlled data input element in the presentation. The name must match a name of a data input defined in the presentation.

This property must be set before setting the value property. The initial value is provided via the constructor, but the name can also be changed later on.

Access functions:

QString | name() const
void | setName(const QString &name)

Notifier signal:

void | nameChanged()

### value : QVariant

Specifies the value of the controlled data input element in the presentation.

The value of this property only accounts for changes done via the same Q3DSDataInput instance. If the value of the same data input in the presentation is changed elsewhere, for example via animations or Q3DSPresentation::setAttribute(), those changes are not reflected in the value of this property.

To get actual values from the presentation, use DataOutput.

Access functions:

QVariant | value() const
void | setValue(const QVariant &value, bool force = false)

Notifier signal:

void | valueChanged()

See also DataOutput.

## Member Function Documentation

### Q3DSDataInput::Q3DSDataInput(Q3DSPresentation *presentation, const QString &name, QObject *parent = nullptr)

Constructs a Q3DSDataInput instance and initializes the name. The constructed instance is automatically associated with the specified presentation. An optional parent object can be specified.

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

Destructor.

### bool Q3DSDataInput::isValid() const

Returns true if presentation (or its subpresentation) associated with this datainput has a datainput definition with a matching name. Returns false if the datainput has no associated presentation, or if a match is not found.

### QString Q3DSDataInput::metadata(const QString &key) const

Returns the metadata defined for this datainput with metadata key.

Metadata is user-defined key-value table that can be used, for example, to better describe the usage of, or to indicate the external data source that should be bound to this datainput. Metadata has no impact on presentation rendering.

Note: Datainput metadata is read-only.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### QStringList Q3DSDataInput::metadataKeys() const

Returns the metadata keys defined for this datainput.

Note: Getter function for property metadataKeys.

See also metadata.

### `[slot]` void Q3DSDataInput::setValue(const QVariant &value, bool force = false)

Q3DSDataInput::setValue Set a new value for this data input.

SetValue calls are batched within a single frame period. The most recently set value will be used to commit a change event for the runtime engine at the end of frame period. By default, a change event is only created if the new value is actually different from the previous frame's committed value.

Use force parameter to force commit a change. This can be useful in situations where the target element property is being changed by several controllers, and the caller wants to be certain that value change will be processed. Note that animations take precedence over datainput control.

Note: For performance reasons do not call setValue with force set to true unnecessarily.

Note: Setter function for property value.

See also value().