summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-30 06:53:49 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-30 06:53:49 (GMT)
commitfcca6e40558e7b146d69ad82b3da2ff19ed5cf76 (patch)
tree8e3be68327f0acb1f3e61c2b724c8d994ed11cb0 /src/script/api/qscriptengine.cpp
parent939e59f7f3cd23ab429c48d1be8f3d98f94962ad (diff)
downloadQt-fcca6e40558e7b146d69ad82b3da2ff19ed5cf76.zip
Qt-fcca6e40558e7b146d69ad82b3da2ff19ed5cf76.tar.gz
Qt-fcca6e40558e7b146d69ad82b3da2ff19ed5cf76.tar.bz2
port recent changes from qt/master
Makes variant conversion work for signal handlers.
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index a8071ba..9e789bf 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -46,7 +46,6 @@
#endif
Q_DECLARE_METATYPE(QScriptValue)
-Q_DECLARE_METATYPE(QVariant)
#ifndef QT_NO_QOBJECT
Q_DECLARE_METATYPE(QObjectList)
#endif
@@ -1982,8 +1981,6 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr)
result = *reinterpret_cast<const QScriptValue*>(ptr);
if (!result.isValid())
result = QScriptValue(QScriptValue::UndefinedValue);
- } else if (type == qMetaTypeId<QVariant>()) {
- result = scriptValueFromVariant(*reinterpret_cast<const QVariant*>(ptr));
}
#ifndef QT_NO_QOBJECT
@@ -2000,6 +1997,8 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr)
else {
QByteArray typeName = QMetaType::typeName(type);
+ if (typeName == "QVariant")
+ result = scriptValueFromVariant(*reinterpret_cast<const QVariant*>(ptr));
if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(ptr))
result = QScriptValue(QScriptValue::NullValue);
else
@@ -2172,7 +2171,7 @@ bool QScriptEnginePrivate::convert(const QScriptValue &value,
return false;
*reinterpret_cast<QScriptValue*>(ptr) = value;
return true;
- } else if (type == qMetaTypeId<QVariant>()) {
+ } else if (name == "QVariant") {
*reinterpret_cast<QVariant*>(ptr) = value.toVariant();
return true;
}