Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
qRegisterMetaType<TYPE> being type of QQmlComponent
bnogal last edited by bnogal
actually you can register types under QMetaType system so you can work with the classes using QVariant.
It is also possible to create "classes" from QML files, these classes inherit QObject
But these classes are not registerted on QMetaType system, seems they have their own QQmlMetaType, but it is private.
You can register a qml file using qmlRegisterType(URL, uri, mayor version, minor version, type name) but you cant register that as qRegisterMetaType requires a class!
There is a way to register the type under QMetaType?
or how i can work with QML defined types on QVariants?
i am overcomplicating myself?
Thanks in advance
Correct me if I'm wrong, but you don't define classes in QML. As far as my superficial understanding of QML goes, you define objects (and their hierarchies) in your qml file, so what would you want to register with the meta-type system exactly?
bnogal last edited by
that is the point.
C++ classes are fixed as it is compiled.
i want QML "Components" work as C++ classes, being the instances of them "objects"
I want to create a plugin, than includes C++ classes and QML files implementing that classes. I want to be able to store and reload these instances by using QVariant
i start to think that i should forget about QMetaType ids, and work just with the names... if it is a C++ instantiate it and work with that, and if it is a QML, use the QQmlComponent to build one and work with that...