Closed ghost closed 7 years ago
Aren't nested items just values that belong to a default property of type
list
On Mon, Jan 30, 2017 at 1:40 PM, orbifx notifications@github.com wrote:
@orbifx commented on this pull request.
In lablqml/src_tests/test3.qml https://github.com/Kakadu/lablqt/pull/41:
+import QtQuick 2.1 +import QtQuick.Controls 1.0 + +/ Demonstraction of direct property binding +OCaml binds to objects named "test" and "mirror". +When test changes, the binding function is called and the +mirror's text value is set / + +ApplicationWindow {
- visible: true
- QtObject {
- id: t
- objectName: "test"
- property string msg: "Hello world! Hello Qml with OCaml!"
- // QtObjects can only be nested as properties
Yes. But in QML not every thing needs to be nested using property ... You can nest with declaring a nested Item.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Kakadu/lablqt/pull/41, or mute the thread https://github.com/notifications/unsubscribe-auth/AAav0g6PUkBGUATfNIXdd8obQKhAXwCzks5rXbArgaJpZM4LwoS2 .
Yes you can access them via that property as a list. But we don't have list traversal at this point.
But does it mean that we can't declare right children property for any particular QtObject?
On Wed, Feb 1, 2017 at 12:15 AM, orbifx notifications@github.com wrote:
@orbifx commented on this pull request.
In lablqml/src_tests/test3.qml https://github.com/Kakadu/lablqt/pull/41:
+import QtQuick 2.1 +import QtQuick.Controls 1.0 + +/ Demonstraction of direct property binding +OCaml binds to objects named "test" and "mirror". +When test changes, the binding function is called and the +mirror's text value is set / + +ApplicationWindow {
- visible: true
- QtObject {
- id: t
- objectName: "test"
- property string msg: "Hello world! Hello Qml with OCaml!"
- // QtObjects can only be nested as properties
You will notice that child objects can be added to any Item-based type without explicitly adding them to the children property. This is because the default property of Item is its data property, and any items added to this list for an Item are automatically added to its list of children.
from: http://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html# default-properties
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Kakadu/lablqt/pull/41, or mute the thread https://github.com/notifications/unsubscribe-auth/AAav0urbbuMxirm4hRJqfI-Ibm93IOzQks5rX5ZogaJpZM4LwoS2 .
Binding to QML properties: read, write and change callbacks.