Curious problem, this should work, right?

//FILE: MyRect.qml
Rectangle {
  property double myDouble: 0
}

//FILE: MyParent.qml
Item {
  id: myParent
  onChildrenChanged: {
    for(var i = 0; i < myParent.children.length; ++i) {
      // Error:  Cannot assign to non-existent property "myDouble"
      myParent.children.[i].myDouble = 1.0
    }
  }
}

MyRect {
  parent: myParent
}

Everything instantiates properly, and "MyRect" is properly
being parented under "MyParent", with "onChildrenChanged"
being called.

Can I not access the custom property?  Do I need to cast
to a "MyRect" inside "onChildrenChanged"?

In this case, I *always* know it is a "MyRect", but I thought
the dynamic typing would have found the "myDouble"
property.

Should this code work?  (Or what should I do instead?)

Thanks!

--charley
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to