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:
- In the Connections view, select the Properties tab.
- Select the (Add) button to add a dynamic property for the currently selected item. The item ID is displayed in the Item column.
- Double-click the value in the Property column to give a name to the property.
- Double-click the value in the Property Type column to specify the type of the property.
- 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.