On 11/22/2011 04:35 AM, bea....@nokia.com wrote:
> Hi Harri,
>
> On 22/11/2011, at 3:49 AM, ext Harri Pasanen wrote:
>> 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?
>
> I can't reproduce this error with the built-in example - but, based on the 
> error, I'm guessing that in your code, the guests list hasn't actually been 
> populated somehow, so guests[1] isn't actually referencing a valid object.
>

Ok, I'll try to boil it down to a small complete example that will 
either demonstrate the problem or show me the error of my ways.  (Often 
it is the latter...)

>> 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?
> The BirthdayParty example just uses the simpler convenience constructor. 
> Generally you would want to use the constructor that accepts the append-type 
> function that will allow you to, for example, control the ownership of the 
> object that has been appended to the list. In the PieChart example, the 
> append_slice function also sets the parentItem of all append objects to be 
> the PieChart itself; this wouldn't be possible if the list had been created 
> with the convenience QDeclarativeListProperty constructor that doesn't accept 
> an append function.
>
>
>> 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.
>
> Yes, the paths to the examples are shown on the tutorial pages on 
> http://developer.qt.nokia.com/doc/qt-4.7/declarative-tutorials-extending-chapter5-listproperties.html
>  and http://developer.qt.nokia.com/doc/qt-4.7/qml-extending.html. That is, 
> the PieChart example is located under 
> examples/declarative/tutorials/extending/ and BirthdayParty is under 
> examples/declarative/cppextensions/referenceexamples.
>

Ok, I found the PieChart.   BirthdayParty does not seem to be there 
though, there is no cppextensions subdirectory.

/Harri




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

Reply via email to