My app uses both c++ and QML.
I\'ve defined several objects in C++ part to access SQL etc.
It looks like:
You can use
QQmlApplicationEngine engine;
engine.globalObject().setProperty("CppCreator", engine.newQObject(&CppCreator::GetInstance()));
CppCreator is an QObject to create other c++ object
Q_INVOKABLE QObject* Create(const QString& type_name);
Then you can create c++ object in qml js like
var test = CppCreator.Create("Your Type");
It is not perfect but satisfied my requirement. Hope it helps you.