diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 9 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper_p.h | 3 | ||||
| -rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 11 | ||||
| -rw-r--r-- | src/qml/qml/qqmltypewrapper_p.h | 3 |
4 files changed, 26 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index ad3ebe5f0c..f1b0e0bdc4 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -646,6 +646,15 @@ void QObjectWrapper::setProperty(ExecutionContext *ctx, int propertyIndex, const return setProperty(m_object, ctx, property, value); } +bool QObjectWrapper::isEqualTo(Managed *a, Managed *b) +{ + QV4::QObjectWrapper *qobjectWrapper = a->as<QV4::QObjectWrapper>(); + if (QV4::QmlTypeWrapper *qmlTypeWrapper = b->asObject()->as<QV4::QmlTypeWrapper>()) + return qmlTypeWrapper->toVariant().value<QObject*>() == qobjectWrapper->object(); + + return false; +} + ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QQmlData *ddata, QObject *object) { QQmlEngine *qmlEngine = engine->v8Engine->engine(); diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 3a420abedb..a73c96d098 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -97,6 +97,9 @@ struct Q_QML_EXPORT QObjectWrapper : public QV4::Object ReturnedValue getProperty(ExecutionContext *ctx, int propertyIndex, bool captureRequired); void setProperty(ExecutionContext *ctx, int propertyIndex, const ValueRef value); +protected: + static bool isEqualTo(Managed *that, Managed *o); + private: ReturnedValue getProperty(ExecutionContext *ctx, QQmlPropertyData *property, bool captureRequired = true); static void setProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, const ValueRef value); diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 3fd39754e5..258442bc1d 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -286,4 +286,15 @@ void QmlTypeWrapper::destroy(Managed *that) static_cast<QmlTypeWrapper *>(that)->~QmlTypeWrapper(); } +bool QmlTypeWrapper::isEqualTo(Managed *a, Managed *b) +{ + QV4::QmlTypeWrapper *qmlTypeWrapperA = a->asObject()->as<QV4::QmlTypeWrapper>(); + if (QV4::QmlTypeWrapper *qmlTypeWrapperB = b->asObject()->as<QV4::QmlTypeWrapper>()) + return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant(); + else if (QV4::QObjectWrapper *qobjectWrapper = b->as<QV4::QObjectWrapper>()) + return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object(); + + return false; +} + QT_END_NAMESPACE diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index 89f31d675a..ee462d6479 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -89,6 +89,9 @@ public: static PropertyAttributes query(const Managed *, StringRef name); static void destroy(Managed *that); +protected: + static bool isEqualTo(Managed *that, Managed *o); + private: QV8Engine *v8; TypeNameMode mode; |
