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
qqmlproxymetaobject_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 QQMLPROXYMETAOBJECT_P_H
6#define QQMLPROXYMETAOBJECT_P_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 <private/qtqmlglobal_p.h>
20#include <private/qmetaobjectbuilder_p.h>
21
22#include <QtCore/QMetaObject>
23#include <QtCore/QObject>
24
25#include <private/qobject_p.h>
26
28
29class Q_QML_EXPORT QQmlProxyMetaObject : public QDynamicMetaObjectData
30{
31public:
32 struct ProxyData {
33 typedef QObject *(*CreateFunc)(QObject *);
34 QMetaObject *metaObject;
35 CreateFunc createFunc;
36 int propertyOffset;
37 int methodOffset;
38 };
39
40 QQmlProxyMetaObject(QObject *, const QList<ProxyData> *);
41 ~QQmlProxyMetaObject();
42
43 static constexpr int extensionObjectId(int id) noexcept
44 {
45 Q_ASSERT(id >= 0);
46 Q_ASSERT(id <= MaxExtensionCount); // MaxExtensionCount is a valid index
47 return ExtensionObjectId | id;
48 }
49
50protected:
51 int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
52#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
53 const QMetaObject *toDynamicMetaObject(QObject *) const override
54#else
55 QMetaObject *toDynamicMetaObject(QObject *) override
56#endif
57 {
58 return metaObject;
59 }
60 void objectDestroyed(QObject *object) override;
61
62private:
63 QObject *getProxy(int index);
64
65 const QList<ProxyData> *metaObjects;
66 QObject **proxies;
67
68 QDynamicMetaObjectData *parent;
69 QMetaObject *metaObject;
70 QObject *object;
71
72 // ExtensionObjectId acts as a flag for whether we should interpret a
73 // QMetaObject::CustomCall as a call to fetch the extension object (see
74 // QQmlProxyMetaObject::metaCall()). MaxExtensionCount is a limit on how
75 // many extensions we can query via such mechanism
76 enum : int {
77 MaxExtensionCount = 127, // magic number so that low bits are all '1'
78 ExtensionObjectId = ~MaxExtensionCount,
79 };
80};
81
82QT_END_NAMESPACE
83
84#endif // QQMLPROXYMETAOBJECT_P_H
Combined button and popup list for selecting options.