Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

10K Developer Commitment

Posts: 15
Registered: ‎10-10-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: N/A

Add/Insert dynamically QML element into QML view with C++

I'mt trying to add a custom QML element that I create into another QML view already loaded from C++.

The context is the following: I'm loading a QML view from C++, and I need to inject another QML custom component that I build into this QML view. All in C++.

I've been searching for 4 hours and I haven't found a way to acomplish this.

Here's some code to give you a better perspective:


QmlDocument*qml =QmlDocument::create("asset:///PosicionConsolidad.qml").parent(this);
Page*page = qml->createRootObject<Page>(); myST =GlobalST::getInstance();
LoadInfo(); _mRoot->push(page); _app->setScene(_mRoot); voidProject::LoadInfo() { QmlDocument*qml =QmlDocument::create("asset:///customComponents/TableRow.qml").parent(this); //Here's where I need to append this new QML custom element to the //page previously loaded. //I don't know if I can just inject it or I need to make a find child to //maybe a parent container in the QML view and then add it there. But I //also tried that and didn't work out. }



Please help. Regards.