Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 2.7.0
Description
It is currently not possible to set bindings in the .metainfo file for the ItemLibraryEntry. The current implementation will define default values for properties and bindings are not possible currently.
There is a possible workaround. We can use QML source code to include bindings.
For example, please see [qt-creator]\src\plugins\qmldesigner\qtquickplugin\quick.metainfo file. We will see a statement below.
QmlSource { source: ":/qtquickplugin/source/text.qml" }
The text.qml as shown, or other QML files, can include your custom bindings. For example, a Text binding as shown below from text.qml file.
Text {
text: qsTr("Text")
}
For example, we want to use qsTr() the text property as a binding. It would be nice to use the below declaration in the *.metainfo file.
Binding { name: "parent"; expression: "target" }
or
Binding { name: "text"; expression "qsTr(\"text\")" }