I've been reading the docs on how to do my own QML types with C++, including lists.
http://doc.qt.nokia.com/4.7-snapshot/declarative-cppextensions-referenceexamples-properties.html Has a BirthdayParty sample class with a list of guests. I made a variation of that, but for some reason when in qml I can't index the list: BirthdayParty { host:Person { name:"Bob Jones" shoeSize:12 } guests: [ Person {name:"Leo Hodges" }, Person {name:"Jack Smith" }, Person {name:"Anne Brown" } ] } Component.onCompleted: { console.log("completed") console.log(guests[1].name) } Chokes when it tries to index the guests property, spitting out a message: 'guests[1]' [undefined] is not an object. Should this work, or what am I missing? There is also some other underlying magic going on which is not explicit. http://developer.qt.nokia.com/doc/qt-4.7/declarative-tutorials-extending-chapter5-listproperties-piechart-h.html#id-746a8ac4-61d2-42f8-82d6-2c72cd6c26a0 comes up with some static method called append_slice to populate the list, but why does the birthday party example not feature it? Btw, are the example and tutorial projects show in the documentation downloadable somewhere in compilable format? Cutting and pasting from the doc is not very tempting... Searching for the examples, at least the PieChart and BirthdayParty don't seem to be part of QtSDK examples. /Harri _______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
