summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptdeclarativeobject.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-09 04:22:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-09 04:22:07 (GMT)
commit6a5891e7bfd182a52fd71f1b5fdf4d73def63603 (patch)
tree483385969c470974d505c32184620add5f841d5c /src/script/bridge/qscriptdeclarativeobject.cpp
parentc04a6e34b3d4da24d3cc26e192bebff2d3b79d19 (diff)
downloadQt-6a5891e7bfd182a52fd71f1b5fdf4d73def63603.zip
Qt-6a5891e7bfd182a52fd71f1b5fdf4d73def63603.tar.gz
Qt-6a5891e7bfd182a52fd71f1b5fdf4d73def63603.tar.bz2
Integrate QML's object ownership with the JS collector
QML now behaves in a way similar to QtScript when it comes to QObject ownership. QT-2803
Diffstat (limited to 'src/script/bridge/qscriptdeclarativeobject.cpp')
-rw-r--r--src/script/bridge/qscriptdeclarativeobject.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp
index c6ab6a7..70bb1bb 100644
--- a/src/script/bridge/qscriptdeclarativeobject.cpp
+++ b/src/script/bridge/qscriptdeclarativeobject.cpp
@@ -198,6 +198,23 @@ bool DeclarativeObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecStat
return QScriptObjectDelegate::hasInstance(object, exec, value, proto);
}
+bool DeclarativeObjectDelegate::compareToObject(QScriptObject *o, JSC::ExecState *exec, JSC::JSObject *o2)
+{
+ if (!o2->inherits(&QScriptObject::info))
+ return false;
+
+ QScriptObject *scriptObject = static_cast<QScriptObject*>(o2);
+ QScriptObjectDelegate *delegate = scriptObject->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::DeclarativeClassObject))
+ return false;
+
+ DeclarativeObjectDelegate *other = static_cast<DeclarativeObjectDelegate*>(delegate);
+ if (m_class != other->m_class)
+ return false;
+ else
+ return m_class->compare(m_object, other->m_object);
+}
+
} // namespace QScript
QT_END_NAMESPACE