Results 1 to 2 of 2

Thread: Q_ARG with C++ reference types

  1. #1
    Join Date
    Aug 2008
    Posts
    1
    Platforms
    MacOS X Unix/X11 Windows

    Default Q_ARG with C++ reference types

    Hi,

    Is it possible to use Q_ARG with reference types? For example:

    Qt Code:
    1. void foo(QIODevice& obj)
    2. {
    3. QMetaObject::invokeMethod(this, "fooImpl", Q_ARG(QIODevice&, obj));
    4. }
    To copy to clipboard, switch view to plain text mode 

    This code does not compile because the template type for QArgument is inferred to be QIODevice&, and the QArgument constructor wants a pointer to this type (something like QIODevice&*). Is there a way around this other than simply not using reference types?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Q_ARG with C++ reference types

    Q_ARG serializes arguments so using references there might not be possible.

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  4. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.