summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-05 17:38:39 +0200
committerKent Hansen <kent.hansen@nokia.com>2009-11-30 14:41:20 +0100
commita539ce478800c3dacf8456d206e8fd6dc700ac5c (patch)
tree7b747a304281f06a05f913628f3c78169f3b05d7 /src
parentee0690cdf553b6cf22432488ea113209203fe1ce (diff)
make signal handlers understand QVariant again
Also, issue a warning if a type is not known to the meta-type system. Backport of 508c9cd681244a5ad566c12733aa70f5bd522b57 Task-number: QTBUG-5060
Diffstat (limited to 'src')
-rw-r--r--src/script/qscriptextqobject.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp
index b3b9a54885..4be6b727bf 100644
--- a/src/script/qscriptextqobject.cpp
+++ b/src/script/qscriptextqobject.cpp
@@ -1657,12 +1657,27 @@ void QScript::QObjectConnectionManager::execute(int slotIndex, void **argv)
activation_data->m_members[i].object(nameId, i,
QScriptValue::Undeletable
| QScriptValue::SkipInEnumeration);
+ QScriptValueImpl actual;
if (i < argc) {
- int argType = QMetaType::type(parameterTypes.at(i));
- activation_data->m_values[i] = eng->create(argType, argv[i + 1]);
+ void *arg = argv[i + 1];
+ QByteArray typeName = parameterTypes.at(i);
+ int argType = QMetaType::type(typeName);
+ if (!argType) {
+ if (typeName == "QVariant") {
+ actual = eng->valueFromVariant(*reinterpret_cast<QVariant*>(arg));
+ } else {
+ qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' "
+ "when invoking handler of signal %s::%s",
+ typeName.constData(), meta->className(), method.signature());
+ actual = eng->undefinedValue();
+ }
+ } else {
+ actual = eng->create(argType, arg);
+ }
} else {
- activation_data->m_values[i] = eng->undefinedValue();
+ actual = eng->undefinedValue();
}
+ activation_data->m_values[i] = actual;
}
QScriptValueImpl senderObject;