summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-21 10:56:11 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-21 14:29:16 (GMT)
commit65b4ce3c51283adb76dcb73cc654b06359b1ae00 (patch)
treec71e10c6da5f986cc83ab520efce3a5952114efe /src/script/bridge/qscriptqobject.cpp
parent1b34feacef7a2d3ac005449a7cfbcb08a6bbf947 (diff)
downloadQt-65b4ce3c51283adb76dcb73cc654b06359b1ae00.zip
Qt-65b4ce3c51283adb76dcb73cc654b06359b1ae00.tar.gz
Qt-65b4ce3c51283adb76dcb73cc654b06359b1ae00.tar.bz2
QtScript: Fix comparing QVariant and QObject.
This add a hook inside JSC to be able to implement our own comparison function when comparing objects. Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/bridge/qscriptqobject.cpp')
-rw-r--r--src/script/bridge/qscriptqobject.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index b7df781..236f899 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1572,6 +1572,18 @@ void QObjectDelegate::mark(QScriptObject *object)
QScriptObjectDelegate::mark(object);
}
+bool QObjectDelegate::compareToObject(QScriptObject *, JSC::ExecState *exec, JSC::JSObject *o2)
+{
+ if(!o2->inherits(&QScriptObject::info))
+ return false;
+ QScriptObject *object = static_cast<QScriptObject*>(o2);
+ QScriptObjectDelegate *delegate = object->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::QtObject))
+ return false;
+ return value() == static_cast<QObjectDelegate *>(delegate)->value();
+}
+
+
static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncFindChild(JSC::ExecState *exec, JSC::JSObject*,
JSC::JSValue thisValue, const JSC::ArgList &args)
{