Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Q_ARG and templates
Qt 6.12 LTS is out! See what's new in the release blog

Q_ARG and templates

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    0

    • Login

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