diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-06-04 14:43:38 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-09 01:36:23 +0200 |
commit | 49a3883e86b61d8facfeea9c43037d484cb50b92 (patch) | |
tree | ba1afdf6ddc3740f26c5e3c95cb2fffeb953abb4 /tests/auto/qml/qqmlecmascript/testtypes.h | |
parent | 3095493a4ce4bec11b9381a3d1d23f17b313332c (diff) |
Use V4 binding for non-final properties where possible
When a property referenced in a binding is not marked as final, do not
automatically abort optimization. Instead generate both V4 and V8
binidngs, and only fall back to the V8 binding if necessary at run time.
Change-Id: I1bcc7e2b495935c5d519a9a223f640c1972cdb4e
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/testtypes.h')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 06e54ea552..d857b64d80 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1496,6 +1496,104 @@ private: MyEnum m_ev; }; +class FallbackBindingsObject : public QObject +{ + Q_OBJECT + Q_PROPERTY (int test READ test NOTIFY testChanged) +public: + FallbackBindingsObject(QObject* parent = 0) + : QObject(parent), m_test(100) + { + } + + int test() const { return m_test; } + +Q_SIGNALS: + void testChanged(); + +private: + int m_test; +}; + +class FallbackBindingsDerived : public FallbackBindingsObject +{ + Q_OBJECT + Q_PROPERTY (QString test READ test NOTIFY testChanged) +public: + FallbackBindingsDerived(QObject* parent = 0) + : FallbackBindingsObject(parent), m_test("hello") + { + } + + QString test() const { return m_test; } + +Q_SIGNALS: + void testChanged(); + +private: + QString m_test; +}; + +class FallbackBindingsAttachedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY (int test READ test NOTIFY testChanged) +public: + FallbackBindingsAttachedObject(QObject *parent) : QObject(parent), m_test(100) {} + + int test() const { return m_test; } + +Q_SIGNALS: + void testChanged(); + +private: + int m_test; +}; + +class FallbackBindingsAttachedDerived : public FallbackBindingsAttachedObject +{ + Q_OBJECT + Q_PROPERTY (QString test READ test NOTIFY testChanged) +public: + FallbackBindingsAttachedDerived(QObject* parent = 0) + : FallbackBindingsAttachedObject(parent), m_test("hello") + { + } + + QString test() const { return m_test; } + +Q_SIGNALS: + void testChanged(); + +private: + QString m_test; +}; + +class FallbackBindingsTypeObject : public QObject +{ + Q_OBJECT +public: + FallbackBindingsTypeObject() : QObject() {} + + static FallbackBindingsAttachedObject *qmlAttachedProperties(QObject *o) { + return new FallbackBindingsAttachedObject(o); + } +}; + +class FallbackBindingsTypeDerived : public QObject +{ + Q_OBJECT +public: + FallbackBindingsTypeDerived() : QObject() {} + + static FallbackBindingsAttachedObject *qmlAttachedProperties(QObject *o) { + return new FallbackBindingsAttachedDerived(o); + } +}; + +QML_DECLARE_TYPEINFO(FallbackBindingsTypeObject, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPEINFO(FallbackBindingsTypeDerived, QML_HAS_ATTACHED_PROPERTIES) + void registerTypes(); #endif // TESTTYPES_H |