> -----Original Message-----
> From: qt-qml-bounces+igeiser=devonit....@qt.nokia.com [mailto:qt-qml-
> bounces+igeiser=devonit....@qt.nokia.com] On Behalf Of Bo Thorsen
> Sent: Monday, May 21, 2012 2:02 AM
> To: qt-qml@qt.nokia.com
> Subject: Re: [Qt-qml] Importing legacy QGrapicsItems
> 
> Hi Ian,
> 
> Den 19-05-2012 14:49, Ian Geiser skrev:
> > Greetings, I have some C++ QGraphics View code that I would like to
> > move to QML.  The binding was trivial to make the Graphics Items into
> > plugins, but where I get stuck is that I have a model that manages
> the
> > lifetimes of the items.  I am confused as to has to expose this model
> > to QML.  I can place my items on the canvas in the QML, and I can
> > return the QObject pointers from the model.  What I cannot seem to do
> > is place the QGraphicsView items onto the canvas from that point. Any
> > hints?  Thanks!
> 
> You need to convert the classes to QDeclarativeItem subclasses.
> 
> After doing this, I think the only issue you will have is to find the
> proper parent for your items. Things don't turn up in QML unless they
> have a parent.
> 
I think this is where I am stuck now.  I created my QDeclarativeItem, and 
created my root one in a VisualItemModel where and I have that properly showing 
up in the GridView.  I am really confused in the VisualItemModel what my parent 
is.  My impression is that if I could append the newly created QDeclarativeItem 
to the children property that I would be okay.  But like you said finding the 
proper parent is the key issue here.  At the end of the day I can get one of 
the items into the UI, but where I get killed is when the bound 
QDeclarativeItem creates a new QDeclarativeItem that is to be added to the same 
container that the original one is in.

> There is a good amount of information on this page:
> 
> http://qt-project.org/doc/qt-4.8/qtbinding.html
I will study this and see what I can come up with.

> 
> Adding items dynamically using C++ is still awkward. But it is
> possible, I have done it one several customer projects now.
> 
> It's funny that QML is always described as a language for dynamic UIs,
> when in fact it's specifically designed for static UIs where the items
> can move.
Yeah, that is my assessment too.

Thanks!

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

Reply via email to