Q_DECLARE_METATYPE_TEMPLATE_3ARG missing



  • 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 !?


  • Lifetime Qt Champion

    Hi,

    Can you show the code for your use case ?

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



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


  • Qt Champions 2017

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.