diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-05 15:38:39 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-05 15:38:39 (GMT) |
commit | 508c9cd681244a5ad566c12733aa70f5bd522b57 (patch) | |
tree | 67a7b8fe7a530fa42f61f55aa7f2401caff64e72 /src/script/qscriptextqobject.cpp | |
parent | 9691523b796c6acc6a837a5f5a34fef16aa74c48 (diff) | |
download | Qt-508c9cd681244a5ad566c12733aa70f5bd522b57.zip Qt-508c9cd681244a5ad566c12733aa70f5bd522b57.tar.gz Qt-508c9cd681244a5ad566c12733aa70f5bd522b57.tar.bz2 |
make signal handlers understand QVariant again
Also, issue a warning if a type is not known to the meta-type system.
Task-number: 248129
Diffstat (limited to 'src/script/qscriptextqobject.cpp')
-rw-r--r-- | src/script/qscriptextqobject.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp index 0a346f0..47c04d4 100644 --- a/src/script/qscriptextqobject.cpp +++ b/src/script/qscriptextqobject.cpp @@ -1667,12 +1667,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; |