Specifying Dynamic Properties

In addition to the properties predefined for QML types, you can specify dynamic properties to add properties that would not otherwise exist for a particular type. You bind the properties to dynamic expressions to define global properties for an object that can be read by other objects. For example, you can specify global properties for the root object that you can use in the child objects.

For example, to specify spacing between UI elements, you could define a margin for an object of a QML type that does not have a margin property, and then use bindings to refer to the value of the margin property from other objects.

Similarly, you can add dynamic properties at component level.

You can specify dynamic properties for objects in the Connections view.

To specify dynamic properties for an object:

  1. In the Connections view, select the Properties tab.
  2. Select the (Add) button to add a dynamic property for the currently selected item. The item ID is displayed in the Item column.
  3. Double-click the value in the Property column to give a name to the property.
  4. Double-click the value in the Property Type column to specify the type of the property.
  5. Double-click the value in the Property Value column to specify a dynamic expression as the value of the property.

Available under certain Qt licenses.
Find out more.