⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

qRegisterMetaType<TYPE> being type of QQmlComponent

  • 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

  • Moderators

    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?

    Kind regards.

  • 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...

Log in to reply