Important: Please read the Qt Code of Conduct -

Q_ARG and templates

  • It is very difficult to work reasonably with Q_ARG and Q_RETURN_ARG when having template types. In the end I had to use meta-function for naming types like:

    @template< typename T >
    class TypeQtName;

    #define MAKE_TYPEQTNAME( T )
    class TypeQtName< T >
    static const char* const get()
    return #T;
    }; \

    /* ... */@

    But this approach is far from being elegant.

    What I think could be useful is to extend Qt so that it could locally deal with typeid result (the std::type_info class). That is not portable even across two executions of the same program in the same environment. But within a single execution it is and that does cover lots of cases.

    What do you think about it?

Log in to reply