PDA

View Full Version : QHash as QMetaObject::invokeMethod argument



^NyAw^
1st October 2014, 15:03
Hi,

I have a compilation error when trying to use


QMetaObject::invokeMethod(pObject,"method",Qt::QueuedConnection,Q_ARG(QHash<QString,QVariant>,qHashParams));


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

Thanks,

stampede
1st October 2014, 17:00
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.

anda_skoa
1st October 2014, 18:04
It should work with a typedef.

Which in this case even exists already: http://qt-project.org/doc/qt-5/qvariant.html#QVariantHash-typedef

Cheers,
_