diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2013-11-13 11:03:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-14 08:03:55 +0100 |
commit | 1df8a42e5b7fc718121dc92dd7203046d25015e0 (patch) | |
tree | 140b430265e1f92d70236e792d08e92356a016c8 /src/qml/qml | |
parent | 3afffa47feabc80e1bc20ffd2143a722a1c360a2 (diff) |
Allow passing qmlRegisterSingletonType QObjects to C++ as QObject*
At the moment you can pass them as their FinalType* or
as one of their ParentType* but not as QObject* which
does not make much sense to me
Task-number: QTBUG-34617
Task-number: QTBUG-30730
Change-Id: Id5cfb7bbb123456ef43f44f33b450f8966a7641a
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper_p.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index f309d69136..3fd39754e5 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -69,6 +69,11 @@ QmlTypeWrapper::~QmlTypeWrapper() typeNamespace->release(); } +bool QmlTypeWrapper::isSingleton() const +{ + return type && type->isSingleton(); +} + QVariant QmlTypeWrapper::toVariant() const { if (type && type->isSingleton()) { diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index 9078c184c6..89f31d675a 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -76,6 +76,8 @@ private: public: enum TypeNameMode { IncludeEnums, ExcludeEnums }; + bool isSingleton() const; + QVariant toVariant() const; static ReturnedValue create(QV8Engine *, QObject *, QQmlType *, TypeNameMode = IncludeEnums); |