I tried to use QQmlComponent component(view.engine(), QUrl::fromLocalFile("MyItem.qml")); and then QOObject *object = component.create(); but it gives me Qml Component not ready. Further tried to connect the statusChanged signal to a slot function, but it doesnt seem to load the new qml components.
QQuickView view;
view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
QQmlComponent component(view.engine(), QUrl::fromLocalFile("MyItem.qml"));
QObject *object = component.create();
object->setParent(view.rootObject());
view.show()