Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved Q_DECLARE_METATYPE_TEMPLATE_3ARG missing

    General and Desktop
    3
    4
    565
    Loading More Posts
    • 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
      pip010 last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • P
          pip010 last edited by 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
          ?

          kshegunov 1 Reply Last reply Reply Quote 0
          • kshegunov
            kshegunov Moderators @pip010 last edited by

            @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 Reply Quote 3
            • First post
              Last post