来自:http://qt-project.org/doc/qt-4.8/qtbinding.html#calling-functions
QMetaObject :: invokeMethod (object, "myQmlFunction", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, msg));
但是,函数参数说:
来自:http://qt-project.org/doc/qt-4.8/qmetaobject.html#invokeMethod
bool QMetaObject::invokeMethod ( QObject * obj, const char * member, Qt::ConnectionType
type, QGenericReturnArgument ret, QGenericArgument val0 = QGenericArgument( 0 ),
QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(), QGenericArgument val4 = QGenericArgument(),
QGenericArgument val5 = QGenericArgument(), QGenericArgument val6 = QGenericArgument(),
QGenericArgument val7 = QGenericArgument(), QGenericArgument val8 = QGenericArgument(),
QGenericArgument val9 = QGenericArgument() ) [static]
所以,这个函数的第三个参数是:
Qt::ConnectionType
Q_RETURN_ARG (QVariant, returnedValue)
如何与Qt::ConnectionType
对应?
答案 0 :(得分:1)
look again at the documentation invokeMethod
有多个重载,其中一个包含:
bool QMetaObject::invokeMethod ( QObject * obj, const char * member,
QGenericReturnArgument ret,
QGenericArgument val0 = QGenericArgument( 0 ),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
QGenericArgument val4 = QGenericArgument(),
QGenericArgument val5 = QGenericArgument(),
QGenericArgument val6 = QGenericArgument(),
QGenericArgument val7 = QGenericArgument(),
QGenericArgument val8 = QGenericArgument(),
QGenericArgument val9 = QGenericArgument() ) [static]
因此调用者不需要指定连接类型和/或关心返回参数