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);
qml->setContextProperty("pos", this);
Page *page = qml->createRootObject<Page>();
myST = GlobalST::getInstance();
LoadInfo();
_mRoot->push(page);
_app->setScene(_mRoot);
void Project::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.