DataInput QML Type | Runtime 2.1

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

Qt 3D Studio Runtime 2.1 Manual

# DataInput QML Type

Controls a data input entry in a Qt 3D Studio presentation. More...

Import Statement: | import .
Instantiates: | Q3DSDataInput

- List of all members, including inherited members

## Properties

- name : string
- value : variant

## Detailed Description

This type is a convenience for controlling a data input in a presentation. Its functionality is equivalent to Presentation::setDataInputValue(), however it has a big advantage of being able to use QML property bindings, thus avoiding the need to having to resort to a JavaScript function call for every value change.

As an example, compare the following two approaches:

      Studio3D {
          ...
          Presentation {
              id: presentation
              ...
          }
      }

      Button {
          onClicked: presentation.setAttribute("SomeTextNode", "textstring", "Hello World")
      }

      Studio3D {
          ...
          Presentation {
              id: presentation
              ...
              property string text: ""
              DataInput {
                  name: "inputForSomeTextNode"
                  value: presentation.text
              }
          }
      }

      Button {
          onClicked: presentation.text = "Hello World"
      }

The latter assumes that a data input connection was made in Qt 3D Studio between the `textstring` property of `SomeTextNode` and a data input name `inputForSomeTextNode`. As the value is now set via a property, the full set of QML property bindings techniques are available.

See also Studio3D and Presentation.

## Property Documentation

name : string

Specifies the name of the controlled data input element in the presentation. This property must be set as part of DataInput declaration, although it is changeable afterwards, if desired.

value : variant

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 DataInput instance. If the value of the underlying attribute in the presentation is changed elsewhere, for example via animations or Presentation::setAttribute(), those changes are not reflected in the value of this property. Due to this uncertainty, this property treats all value sets as changes even if the newly set value is the same value as the previous value.