You are trying to pass a QString to the second argument, whereas that should be const char*
. Convert that to the proper type because there is no implicit conversion. You need to decide which way to convert it to QByteArray
first, so this is one example that you could potentially write:
QMetaObject::invokeMethod(object, func.toUtf8().constData(), Qt::DirectConnection, Q_ARG(QVariant, p1), Q_ARG(QVariant, p2));