diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-16 16:41:27 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-23 14:54:46 +0200 |
commit | 8e222a70d19d5eef616e1d6306415da64fbab4cb (patch) | |
tree | 535e4cd02c2dbca0289bc6ec39f2699856554737 /src/qml/qml/qqmlglobal.cpp | |
parent | 90b5d7fa03f9818fa5edc897ee6a109fcc182b9e (diff) |
Allow proper registration of value types
You can now have an extension object on a value type that offers
additional properties. This is how we model the QtQuick value types. It
allows us to retrieve the extension's metaobject without using the
virtual functions in the value type provider.
As before, this mechanism is still rather dangerous and not fit for
public consumption. It relies on the extension object having exactly the
same layout as the original value type, and it hides any properties the
original value type might expose.
Furthermore we enforce now that gadgets should have lowercase names.
The ones that didn't before are split up into an anonymous value type
and a namespace that contains all the addressable bits.
Task-number: QTBUG-82443
Change-Id: Ic93d6764538d6ccc0774b3c5648eee08ba0939c0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlglobal.cpp')
-rw-r--r-- | src/qml/qml/qqmlglobal.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp index cd08a5270c..0cc7c525c7 100644 --- a/src/qml/qml/qqmlglobal.cpp +++ b/src/qml/qml/qqmlglobal.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include <private/qqmlglobal_p.h> +#include <QtQml/private/qqmlmetatype_p.h> #include <QtQml/qqmlengine.h> #include <QtCore/qvariant.h> @@ -57,17 +58,6 @@ QQmlValueTypeProvider::~QQmlValueTypeProvider() QQml_removeValueTypeProvider(this); } -const QMetaObject *QQmlValueTypeProvider::metaObjectForMetaType(int type) -{ - QQmlValueTypeProvider *p = this; - do { - if (const QMetaObject *mo = p->getMetaObjectForMetaType(type)) - return mo; - } while ((p = p->next)); - - return nullptr; -} - bool QQmlValueTypeProvider::initValueType(int type, QVariant& dst) { const QMetaType metaType(type); @@ -179,7 +169,6 @@ bool QQmlValueTypeProvider::writeValueType(int type, const void *src, QVariant& return true; } -const QMetaObject *QQmlValueTypeProvider::getMetaObjectForMetaType(int) { return nullptr; } bool QQmlValueTypeProvider::create(int, int, const void *[], QVariant *) { return false; } bool QQmlValueTypeProvider::createFromString(int, const QString &, void *, size_t) { return false; } bool QQmlValueTypeProvider::variantFromString(int, const QString &, QVariant *) { return false; } |