How about setParentItem() ?

From: [email protected] 
[mailto:[email protected]] On Behalf Of ext 
Tibo W
Sent: 27.05.2011 03:03
To: [email protected]
Subject: [Qt-qml] Add item to a child

Hi,

by following the online doc, I can add a QML item to the top item:

QGraphicsScene *scene = declarativeView->scene();
QDeclarativeEngine *engine = declarativeView->engine();
QDeclarativeComponent component(engine, QUrl::fromLocalFile("file.qml"));
QGraphicsObject *object = qobject_cast<QGraphicsObject *>(component.create());
scene->addItem(object);

Now, I'd like to add an item to a child.
I can find the QML child by doing that:

QObject *root = declarativeView->rootObject();
QGraphicsObject *child = root->findChild<QGraphicsObject *>("childItem");

But I can't add an item to it. I tried setParent() etc. but it's not working.
I feel I'm missing something obvious...

Thanks for your help !


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

Reply via email to