| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef NODEINSTANCEMETAOBJECT_H |
| 5 | #define NODEINSTANCEMETAOBJECT_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qquickdesignersupport_p.h" |
| 19 | |
| 20 | #include <QQmlContext> |
| 21 | #include <QScopedPointer> |
| 22 | #include <private/qqmlopenmetaobject_p.h> |
| 23 | #include <private/qqmlvmemetaobject_p.h> |
| 24 | |
| 25 | #include <QtCore/qpointer.h> |
| 26 | |
| 27 | #include <memory> |
| 28 | |
| 29 | QT_BEGIN_NAMESPACE |
| 30 | |
| 31 | struct MetaPropertyData; |
| 32 | |
| 33 | class QQmlDesignerMetaObject : public QQmlOpenMetaObject |
| 34 | { |
| 35 | public: |
| 36 | ~QQmlDesignerMetaObject(); |
| 37 | |
| 38 | static void registerNotifyPropertyChangeCallBack(void (*callback)(QObject*, const QQuickDesignerSupport::PropertyName &propertyName)); |
| 39 | |
| 40 | protected: |
| 41 | static QQmlDesignerMetaObject* getNodeInstanceMetaObject(QObject *object, QQmlEngine *engine); |
| 42 | |
| 43 | void createNewDynamicProperty(const QString &name); |
| 44 | int createProperty(const char *name, const char *passAlong) override; |
| 45 | int openMetaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a); |
| 46 | int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override; |
| 47 | void notifyPropertyChange(int id); |
| 48 | void setValue(int id, const QVariant &value); |
| 49 | QVariant propertyWriteValue(int, const QVariant &) override; |
| 50 | |
| 51 | QObject *myObject() const { return object(); } |
| 52 | |
| 53 | QDynamicMetaObjectData *dynamicMetaObjectParent() const; |
| 54 | |
| 55 | int propertyOffset() const; |
| 56 | |
| 57 | int count() const; |
| 58 | QByteArray name(int) const; |
| 59 | |
| 60 | private: |
| 61 | QQmlDesignerMetaObject(QObject *object, QQmlEngine *engine); |
| 62 | void init(QObject *); |
| 63 | |
| 64 | QQmlPropertyCache::Ptr cache() const; |
| 65 | |
| 66 | QPointer<QQmlContext> m_context; |
| 67 | QScopedPointer<MetaPropertyData> m_data; |
| 68 | |
| 69 | friend class QQuickDesignerSupportProperties; |
| 70 | }; |
| 71 | |
| 72 | QT_END_NAMESPACE |
| 73 | |
| 74 | #endif // NODEINSTANCEMETAOBJECT_H |
| 75 | |