Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Q_ARG and templates

    General and Desktop
    1
    1
    1065
    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.
    • A
      Adam Badura last edited by

      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 )
      template<>
      class TypeQtName< T >
      {
      public:
      static const char* const get()
      {
      return #T;
      }
      }; \

      MAKE_TYPEQTNAME( bool )
      /* ... */@

      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?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post