diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-08-22 17:01:04 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-31 05:03:34 +0200 |
commit | 9140731319269c75f24e80075750971e00844906 (patch) | |
tree | beaf13b75b87e648aab8ed0d69b30e1d30176aff /tests/auto/declarative/qdeclarativeecmascript/testtypes.h | |
parent | 1646db78918f740c5e5a7e487914f56d732f4a17 (diff) |
Add enums support to QObject module APIs
This commit adds support for retrieving enum values from QObject
module APIs.
Task-number: QTBUG-21033
Task-number: QTBUG-21056
Change-Id: Ib2bd107f3f5905e2d2d35f8a20c55045ef9bb322
Reviewed-on: http://codereview.qt.nokia.com/3291
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/testtypes.h')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/testtypes.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index d88fcd0fd8..2738ee3d60 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -934,6 +934,7 @@ private: class testQObjectApi : public QObject { Q_OBJECT + Q_ENUMS(MyEnum) Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged) Q_PROPERTY (int qobjectTestWritableProperty READ qobjectTestWritableProperty WRITE setQObjectTestWritableProperty NOTIFY qobjectTestWritablePropertyChanged) @@ -945,6 +946,8 @@ public: ~testQObjectApi() {} + enum MyEnum { EnumValue1 = 25, EnumValue2 = 42 }; + Q_INVOKABLE int qobjectEnumTestMethod(MyEnum val) { return (static_cast<int>(val) + 5); } Q_INVOKABLE int qobjectTestMethod(int increment = 1) { m_methodCallCount += increment; return m_methodCallCount; } int qobjectTestProperty() const { return m_testProperty; } |