Hi Mark

I had a similar situation in the past and I solved it in pure QML/JavaScript 
using ListModel and its append/insert/set methods. Worked fine, but certainly 
that puts a limit on the data structures used as items (you can store only 
simple data types)

Best regards,
Artem.

On 9.1.2012, at 18.51, Mark Tucker wrote:

> Hello,
>  
> I have a requirement where I need to be able to dynamically create a bunch of 
> objects, and then be able to add them to a list of some sort so I can scroll 
> through them. Each page can potentially be a different item with wildly 
> different properties and functionality so coming up with a single delegate to 
> cover all of these cases is not an option.
>  
> My thinking was to use a VisualItemModel, dynamically create whatever Items I 
> require in Javascript code, and then parent these items I create to the 
> VisualItemModel (with createObject) such that I can then just use this model 
> as the source for a ListView.
>  
> I've run into a problem, however. When I call the "createObject" function on 
> the component, I get the following error message:
>  
> QDeclarativeComponent: Created graphical object was not placed in the 
> graphics scene.
>  
> And the "count" of the VisualItemModel does not increase, and nothing then 
> shows up in my list. Any idea why I am getting such a message and how I can 
> achieve what I require?
>  
> A quick chat with someone in IRC suggested that this may not be possible with 
> VisualItemModel - but to me it seems like precisely the purpose it was 
> designed for...
>  
> Help?
>  
> Thanks
>  
> Mark T
> _______________________________________________
> Qt-qml mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to