Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qRegisterMetaType<TYPE> being type of QQmlComponent
Qt 6.11 is out! See what's new in the release blog

qRegisterMetaType<TYPE> being type of QQmlComponent

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 805 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bnogal
    wrote on last edited by bnogal
    #1

    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

    1 Reply Last reply
    0
    • kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      Hello,
      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.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bnogal
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved