Am 20.08.2010 04:15, schrieb Gregory Schlomoff:
> Thanks for sharing. I was wondering for a long time how to use the qml
> list type. The documentation gives absolutely no clue that you must use
> the bracket syntax, like in C++. I never thought that it was possible to
> do that in javascript.
Yea, it took me some time to figure that out. The documentation is
somehow missing that feature. But also QMLs behavior is a bit strange.
For example, you can use a 'variant' as array if you define it in the
same component in which you use it. Like that:
Item {
property variant names: ["Peter", "Paul", "Marry"]
width: 50
height: 20
Text {
text: names[0] + " " + names[1] + " " + names[2]
}
}
But it won´t work if it is in another component like mentioned earlier.
And there is no clear error indicating what´s going on.
Also I would expect default properties to work with the list<> syntax. E.g.:
Item {
default property list<Item> items
}
But, doing that results in an "Unexpected token `<' " error.
Anyways, I´m still very unexperienced with QML, so if someone knows, why
this behavior makes sense, please let me know :)
Cheers,
Conny
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml