QMetaMethod method = obj->metaObject()->method(3); // get the fourth method in the object's meta-object QString methodName = method.name(); // "void setName(QString)" QListparameterTypes = method.parameterTypes(); // ["QString"]
QMetaMethod method = obj->metaObject()->method(3); // get the fourth method in the object's meta-object QVariantList args = {QString("John")}; // prepare arguments in a list of QVariant objects method.invoke(obj, Qt::DirectConnection, Q_ARG(QString, "John")); // invoke the method with the argumentsPackage/library: Qt C++ library.