Results 1 to 3 of 3

Thread: QHash as QMetaObject::invokeMethod argument

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QHash as QMetaObject::invokeMethod argument

    Hi,

    I have a compilation error when trying to use
    Qt Code:
    1. QMetaObject::invokeMethod(pObject,"method",Qt::QueuedConnection,Q_ARG(QHash<QString,QVariant>,qHashParams));
    To copy to clipboard, switch view to plain text mode 

    Is there any solution or maybe there is another way to do this?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QHash as QMetaObject::invokeMethod argument

    Q_ARG is a macro, C++ preprocessor will parse it as if you had passed three arguments (note the additional colon ',' in the Q_ARG call between QString and QVariant). It should work with a typedef.

  3. The following user says thank you to stampede for this useful post:

    ^NyAw^ (1st October 2014)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QHash as QMetaObject::invokeMethod argument

    Quote Originally Posted by stampede View Post
    It should work with a typedef.
    Which in this case even exists already: http://qt-project.org/doc/qt-5/qvari...ntHash-typedef

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    ^NyAw^ (2nd October 2014)

Similar Threads

  1. Problems with QMetaObject::invokeMethod
    By AlphaWolf in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2012, 12:57
  2. Replies: 3
    Last Post: 20th January 2012, 16:23
  3. Replies: 0
    Last Post: 19th January 2012, 16:52
  4. How to use QMetaObject::invokeMethod?
    By niko in forum Qt Programming
    Replies: 3
    Last Post: 26th January 2008, 17:02
  5. Using QMetaObject::invokeMethod() doesn't work
    By bruccutler in forum Qt Programming
    Replies: 2
    Last Post: 21st February 2007, 23:40

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.