diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2013-11-13 13:31:46 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-18 15:53:57 +0100 |
commit | 96ee6860163bba1e86b032c9c66cb893c666770a (patch) | |
tree | c2519c647f388a305a89d4463c6128da0e32fe3b /tests/auto/qml/qqmlecmascript/testtypes.h | |
parent | 14518ca23766e407a31c2b5abaf8ba1d195a73d8 (diff) |
Make comparison of singletons and qobjects work
Otherwise you can end up with some weird situation in which you have
two objects, you print them and then you print the comparison and get
a Foo(0x858480) b Foo(0x858480) a == b false
Task-number: QTBUG-34651
Change-Id: Id2444d919f039be085eb5ed9112345db691540a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/testtypes.h')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 6dcef2dc6e..556cc32fd3 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -294,10 +294,28 @@ QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) class MyInheritedQmlObject : public MyQmlObject { Q_OBJECT + Q_PROPERTY(MyInheritedQmlObject *myInheritedQmlObjectProperty READ myInheritedQmlObject WRITE setMyInheritedQmlObject) + Q_PROPERTY(MyQmlObject *myQmlObjectProperty READ myQmlObject WRITE setMyQmlObject) + Q_PROPERTY(QObject *qobjectProperty READ qobject WRITE setQObject) public: + MyInheritedQmlObject() : m_myInheritedQmlObject(0), m_myQmlObject(0), m_qobject(0) {} + + MyInheritedQmlObject *myInheritedQmlObject() const { return m_myInheritedQmlObject; } + void setMyInheritedQmlObject(MyInheritedQmlObject * o) { m_myInheritedQmlObject = o; } + + MyQmlObject *myQmlObject() const { return m_myQmlObject; } + void setMyQmlObject(MyQmlObject * o) { m_myQmlObject = o; } + + QObject *qobject() const { return m_qobject; } + void setQObject(QObject * o) { m_qobject = o; } + Q_INVOKABLE bool isItYouQObject(QObject *o); Q_INVOKABLE bool isItYouMyQmlObject(MyQmlObject *o); Q_INVOKABLE bool isItYouMyInheritedQmlObject(MyInheritedQmlObject *o); +private: + MyInheritedQmlObject *m_myInheritedQmlObject; + MyQmlObject *m_myQmlObject; + QObject *m_qobject; }; QML_DECLARE_TYPE(MyInheritedQmlObject) |