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// Qt-Security score:significant
4
5#ifndef QQMLOPENMETAOBJECT_H
6#define QQMLOPENMETAOBJECT_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QMetaObject>
20#include <QtCore/QObject>
21
22#include <private/qobject_p.h>
23#include <private/qqmlrefcount_p.h>
24#include <private/qtqmlglobal_p.h>
25#include <private/qqmlpropertycache_p.h>
26
27QT_BEGIN_NAMESPACE
28
29
30class QQmlEngine;
31class QMetaPropertyBuilder;
33class Q_QML_EXPORT QQmlOpenMetaObjectType final
34 : public QQmlRefCounted<QQmlOpenMetaObjectType>
35{
36public:
37 QQmlOpenMetaObjectType(const QMetaObject *base);
38 ~QQmlOpenMetaObjectType();
39
40 void createProperties(const QList<QByteArray> &names);
41 int createProperty(const QByteArray &name);
42
43 int propertyOffset() const;
44 int signalOffset() const;
45
46 int propertyCount() const;
47 QByteArray propertyName(int) const;
48
49 QQmlPropertyCache::Ptr cache() const;
50
51private:
52 void propertyCreated(int, QMetaPropertyBuilder &);
53
54 QQmlOpenMetaObjectTypePrivate *d;
55 friend class QQmlOpenMetaObject;
56 friend class QQmlOpenMetaObjectPrivate;
57};
58
60class Q_QML_EXPORT QQmlOpenMetaObject : public QAbstractDynamicMetaObject
61{
62public:
63 QQmlOpenMetaObject(QObject *, const QMetaObject * = nullptr);
64 QQmlOpenMetaObject(QObject *, const QQmlRefPointer<QQmlOpenMetaObjectType> &);
65 ~QQmlOpenMetaObject() override;
66
67 QVariant value(const QByteArray &) const;
68 bool setValue(const QByteArray &, const QVariant &, bool force = false);
69 void setValues(const QHash<QByteArray, QVariant> &, bool force = false);
70 QVariant value(int) const;
71 void setValue(int, const QVariant &);
72 QVariant &valueRef(const QByteArray &);
73 bool hasValue(int) const;
74
75 int count() const;
76 QByteArray name(int) const;
77
78 QObject *object() const;
79 virtual QVariant initialValue(int);
80
81 // Be careful - once setCached(true) is called createProperty() is no
82 // longer automatically called for new properties.
83 void setCached(bool);
84
85 bool autoCreatesProperties() const;
86 void setAutoCreatesProperties(bool autoCreate);
87
88 QQmlOpenMetaObjectType *type() const;
89 QDynamicMetaObjectData *parent() const;
90
91 void emitPropertyNotification(const QByteArray &propertyName);
92 void unparent();
93
94protected:
95 int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
96 int createProperty(const char *, const char *) override;
97
98 virtual void propertyRead(int);
99 virtual void propertyWrite(int);
100 virtual QVariant propertyWriteValue(int, const QVariant &);
101 virtual void propertyWritten(int);
102 virtual void propertyCreated(int, QMetaPropertyBuilder &);
103
104
105 bool checkedSetValue(int index, const QVariant &value, bool force);
106
107private:
108 QQmlOpenMetaObjectPrivate *d;
109 friend class QQmlOpenMetaObjectType;
110};
111
112QT_END_NAMESPACE
113
114#endif // QQMLOPENMETAOBJECT_H
QList< 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
Combined button and popup list for selecting options.