Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlopenmetaobject_p.h
Go to the documentation of this file.
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 QQMLOPENMETAOBJECT_H
5#define QQMLOPENMETAOBJECT_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 <QtCore/QMetaObject>
19#include <QtCore/QObject>
20
21#include <private/qobject_p.h>
22#include <private/qqmlrefcount_p.h>
23#include <private/qtqmlglobal_p.h>
24#include <private/qqmlpropertycache_p.h>
25
26QT_BEGIN_NAMESPACE
27
28
29class QQmlEngine;
30class QMetaPropertyBuilder;
32class Q_QML_EXPORT QQmlOpenMetaObjectType final
33 : public QQmlRefCounted<QQmlOpenMetaObjectType>
34{
35public:
36 QQmlOpenMetaObjectType(const QMetaObject *base);
37 ~QQmlOpenMetaObjectType();
38
39 void createProperties(const QVector<QByteArray> &names);
40 int createProperty(const QByteArray &name);
41
42 int propertyOffset() const;
43 int signalOffset() const;
44
45 int propertyCount() const;
46 QByteArray propertyName(int) const;
47
48 QQmlPropertyCache::Ptr cache() const;
49
50private:
51 void propertyCreated(int, QMetaPropertyBuilder &);
52
53 QQmlOpenMetaObjectTypePrivate *d;
54 friend class QQmlOpenMetaObject;
55 friend class QQmlOpenMetaObjectPrivate;
56};
57
59class Q_QML_EXPORT QQmlOpenMetaObject : public QAbstractDynamicMetaObject
60{
61public:
62 QQmlOpenMetaObject(QObject *, const QMetaObject * = nullptr);
63 QQmlOpenMetaObject(QObject *, const QQmlRefPointer<QQmlOpenMetaObjectType> &);
64 ~QQmlOpenMetaObject() override;
65
66 QVariant value(const QByteArray &) const;
67 bool setValue(const QByteArray &, const QVariant &, bool force = false);
68 void setValues(const QHash<QByteArray, QVariant> &, bool force = false);
69 QVariant value(int) const;
70 void setValue(int, const QVariant &);
71 QVariant &valueRef(const QByteArray &);
72 bool hasValue(int) const;
73
74 int count() const;
75 QByteArray name(int) const;
76
77 QObject *object() const;
78 virtual QVariant initialValue(int);
79
80 // Be careful - once setCached(true) is called createProperty() is no
81 // longer automatically called for new properties.
82 void setCached(bool);
83
84 bool autoCreatesProperties() const;
85 void setAutoCreatesProperties(bool autoCreate);
86
87 QQmlOpenMetaObjectType *type() const;
88 QDynamicMetaObjectData *parent() const;
89
90 void emitPropertyNotification(const QByteArray &propertyName);
91 void unparent();
92
93protected:
94 int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
95 int createProperty(const char *, const char *) override;
96
97 virtual void propertyRead(int);
98 virtual void propertyWrite(int);
99 virtual QVariant propertyWriteValue(int, const QVariant &);
100 virtual void propertyWritten(int);
101 virtual void propertyCreated(int, QMetaPropertyBuilder &);
102
103
104 bool checkedSetValue(int index, const QVariant &value, bool force);
105
106private:
107 QQmlOpenMetaObjectPrivate *d;
108 friend class QQmlOpenMetaObjectType;
109};
110
111QT_END_NAMESPACE
112
113#endif // QQMLOPENMETAOBJECT_H
QVector< QByteArray > * deferredPropertyNames
void setPropertyValue(int idx, const QVariant &value)
QQmlRefPointer< QQmlOpenMetaObjectType > type
QQmlOpenMetaObjectPrivate(QQmlOpenMetaObject *_q, QObject *obj)
QVariant & propertyValueRef(int idx)
QDynamicMetaObjectData * parent
void init(const QMetaObject *metaObj)
QHash< QByteArray, int > names
QSet< QQmlOpenMetaObject * > referers