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

Q_DECLARE_METATYPE_TEMPLATE_3ARG missing

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 820 Views 2 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.
  • P Offline
    P Offline
    pip010
    wrote on last edited by
    #1

    I have a custom 3 template arg type I nede to use in QVariant but cannot find Q_DECLARE_METATYPE_TEMPLATE_3ARG !
    How I am suppose to handle such types with two or more args !?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you show the code for your use case ?

      By the way, which version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pip010
        wrote on last edited by pip010
        #3

        OK. disregard, in the end it was NOT needed. But what if I want a custom templated type with more than 2 arguments to be recognized by QVariant : e.g.
        template<typename A, typename B, typename ...C>
        MyClass{};

        can I just use Q_DECLARE_METATYPE to make it visible to the moc
        ?

        kshegunovK 1 Reply Last reply
        0
        • P pip010

          OK. disregard, in the end it was NOT needed. But what if I want a custom templated type with more than 2 arguments to be recognized by QVariant : e.g.
          template<typename A, typename B, typename ...C>
          MyClass{};

          can I just use Q_DECLARE_METATYPE to make it visible to the moc
          ?

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @pip010 said in Q_DECLARE_METATYPE_TEMPLATE_3ARG missing:

          template<typename A, typename B, typename ...C>
          MyClass{};
          

          This is not a class, it's a template for a class. Before you fully specialize that template, there's nothing really to serialize/deserialize. The macro you mention is for internal use (I strongly suspect), to enable serialization of vector/lists and maps/hashes. Anyway, you should use Q_DECLARE_METATYPE.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          3

          • Login

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