26 QByteArray normType = QMetaObject::normalizedType(
" int const *");
33 QMetaObject::invokeMethod(thread,
"quit", Qt::QueuedConnection);
39 QMetaObject::invokeMethod: Unable to handle unregistered datatype
'MyType'
46 QMetaObject::invokeMethod(obj,
"compute", Qt::DirectConnection,
48 QString(
"sqrt"), 42, 9.7);
55 QMetaObject::invokeMethod(obj,
"compute", Qt::DirectConnection,
57 QStringView(u"sqrt"), qsizetype(42), 9.7f);
64 QMetaObject::invokeMethod(obj,
"compute", Qt::DirectConnection,
65 Q_RETURN_ARG(QString, retVal),
66 Q_ARG(QString,
"sqrt"),
91void examples(QObject *obj, QObject *pushButton)
95 const QMetaObject* metaObject = obj->metaObject();
96 QStringList properties;
97 for (
int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
98 properties << QString::fromLatin1(metaObject->property(i).name());
104 const QMetaObject* metaObject = obj->metaObject();
106 for (
int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
107 methods << QString::fromLatin1(metaObject->method(i).methodSignature());
111 int methodIndex = pushButton->metaObject()->indexOfMethod(
"animateClick()");
112 QMetaMethod method = metaObject->method(methodIndex);
113 method.invoke(pushButton, Qt::QueuedConnection);
119 QMetaMethod::invoke: Unable to handle unregistered datatype
'MyType'
126 QByteArray normalizedSignature = QMetaObject::normalizedSignature(
"compute(QString, int, double)");
127 int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature);
128 QMetaMethod method = obj->metaObject()->method(methodIndex);
129 method.invoke(obj, Qt::DirectConnection, qReturnArg(retVal),
130 QString(
"sqrt"), 42, 9.7);
137 QByteArray normalizedSignature = QMetaObject::normalizedSignature(
"compute(QByteArray, qint64, long double)");
138 int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature);
139 QMetaMethod method = obj->metaObject()->method(methodIndex);
140 method.invoke(obj, Qt::DirectConnection, qReturnArg(retVal),
141 QByteArray(
"sqrt"), qint64(42), 9.7L);
148 QByteArray normalizedSignature = QMetaObject::normalizedSignature(
"compute(QString, int, double)");
149 int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature);
150 QMetaMethod method = obj->metaObject()->method(methodIndex);
152 Qt::DirectConnection,
153 Q_RETURN_ARG(QString, retVal),
154 Q_ARG(QString,
"sqrt"),
162 QMetaMethod destroyedSignal = QMetaMethod::fromSignal(&QObject::destroyed);
171 int functionIndex = win.metaObject()->indexOfSlot(
"testFunc()");
172 QMetaMethod mm = win.metaObject()->method(functionIndex);
173 qDebug() << mm.tag();