4 ms·
I'm not sure what you're asking, but the answer to what I think you're asking is that views change by way of bindings. They can also be changed directly/procedu
by WaltPurvis 8y ago
I'm not sure what you're asking, but the answer to what I think you're asking is that views change by way of bindings. They can also be changed directly/procedurally, but I'll give an example of a binding.
(Think of an Item as a visual component, which can either be referred to by an id or, as I've done here, referred to by its children as "parent".)
Item {
property int count: 1
Button {
height: 30; width: 80
onClicked: parent.count++
}
Text {
height: 20; width: 30
text: parent.count
}
}
The text will update every time you click the button.
- profalseidol 8y agoSo nice not so see any < > and ( ) all over the place in addition to { }.
- diroussel 8y agoCan you have higher order components? In react this is a function that returns a component, often taking another component as a parameter. What's nice about react is that the JSX syntax is just sugar that converts to function calls.
- jcelerier 8y ago> Can you have higher order components? In react this is a function that returns a component, often taking another component as a parameter. The standard way to do this in QML is using the Loader object: http://doc.qt.io/qt-5/qml-qtqml-component.html http://doc.qt.io/qt-5/qml-qtqml-component.html You can also go full-eval of course: http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation...