1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Designer of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28
29 //
30 // W A R N I N G
31 // -------------
32 //
33 // This file is not part of the Qt API. It exists for the convenience
34 // of Qt Designer. This header
35 // file may change from version to version without notice, or even be removed.
36 //
37 // We mean it.
38 //
39
40 #ifndef ABSTRACTMETAOBJECT_H
41 #define ABSTRACTMETAOBJECT_H
42
43 #include <QtDesigner/sdk_global.h>
44 #include <QtCore/qvariant.h>
45 #include <QtCore/qflags.h>
46
47 QT_BEGIN_NAMESPACE
48
49 class QDESIGNER_SDK_EXPORT QDesignerMetaEnumInterface
50 {
51 public:
52 QDesignerMetaEnumInterface();
53 virtual ~QDesignerMetaEnumInterface();
54 virtual bool isFlag() const = 0;
55 virtual QString key(int index) const = 0;
56 virtual int keyCount() const = 0;
57 virtual int keyToValue(const QString &key) const = 0;
58 virtual int keysToValue(const QString &keys) const = 0;
59 virtual QString name() const = 0;
60 virtual QString scope() const = 0;
61 virtual QString separator() const = 0;
62 virtual int value(int index) const = 0;
63 virtual QString valueToKey(int value) const = 0;
64 virtual QString valueToKeys(int value) const = 0;
65 };
66
67 class QDESIGNER_SDK_EXPORT QDesignerMetaPropertyInterface
68 {
69 public:
70 enum Kind { EnumKind, FlagKind, OtherKind };
71 enum AccessFlag { ReadAccess = 0x0001, WriteAccess = 0x0002, ResetAccess = 0x0004 };
72 enum Attribute { DesignableAttribute = 0x0001, ScriptableAttribute = 0x0002, StoredAttribute = 0x0004, UserAttribute = 0x0008};
73 Q_DECLARE_FLAGS(Attributes, Attribute)
74 Q_DECLARE_FLAGS(AccessFlags, AccessFlag)
75
76 QDesignerMetaPropertyInterface();
77 virtual ~QDesignerMetaPropertyInterface();
78
79 virtual const QDesignerMetaEnumInterface *enumerator() const = 0;
80
81 virtual Kind kind() const = 0;
82 virtual AccessFlags accessFlags() const = 0;
83 virtual Attributes attributes(const QObject *object = nullptr) const = 0;
84
85 virtual QVariant::Type type() const = 0;
86 virtual QString name() const = 0;
87 virtual QString typeName() const = 0;
88 virtual int userType() const = 0;
89 virtual bool hasSetter() const = 0;
90
91 virtual QVariant read(const QObject *object) const = 0;
92 virtual bool reset(QObject *object) const = 0;
93 virtual bool write(QObject *object, const QVariant &value) const = 0;
94 };
95
96 Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::AccessFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes)97 Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes)
98
99 class QDESIGNER_SDK_EXPORT QDesignerMetaMethodInterface
100 {
101 public:
102 QDesignerMetaMethodInterface();
103 virtual ~QDesignerMetaMethodInterface();
104
105 enum MethodType { Method, Signal, Slot, Constructor };
106 enum Access { Private, Protected, Public };
107
108 virtual Access access() const = 0;
109 virtual MethodType methodType() const = 0;
110 virtual QStringList parameterNames() const = 0;
111 virtual QStringList parameterTypes() const = 0;
112 virtual QString signature() const = 0;
113 virtual QString normalizedSignature() const = 0;
114 virtual QString tag() const = 0;
115 virtual QString typeName() const = 0;
116 };
117
118 class QDESIGNER_SDK_EXPORT QDesignerMetaObjectInterface {
119 public:
120 QDesignerMetaObjectInterface();
121 virtual ~QDesignerMetaObjectInterface();
122
123 virtual QString className() const = 0;
124 virtual const QDesignerMetaEnumInterface *enumerator(int index) const = 0;
125 virtual int enumeratorCount() const = 0;
126 virtual int enumeratorOffset() const = 0;
127
128 virtual int indexOfEnumerator(const QString &name) const = 0;
129 virtual int indexOfMethod(const QString &method) const = 0;
130 virtual int indexOfProperty(const QString &name) const = 0;
131 virtual int indexOfSignal(const QString &signal) const = 0;
132 virtual int indexOfSlot(const QString &slot) const = 0;
133
134 virtual const QDesignerMetaMethodInterface *method(int index) const = 0;
135 virtual int methodCount() const = 0;
136 virtual int methodOffset() const = 0;
137
138 virtual const QDesignerMetaPropertyInterface *property(int index) const = 0;
139 virtual int propertyCount() const = 0;
140 virtual int propertyOffset() const = 0;
141
142 virtual const QDesignerMetaObjectInterface *superClass() const = 0;
143 virtual const QDesignerMetaPropertyInterface *userProperty() const = 0;
144 };
145
146 // To be obtained from core
147 class QDESIGNER_SDK_EXPORT QDesignerIntrospectionInterface {
148 public:
149 QDesignerIntrospectionInterface();
150 virtual ~QDesignerIntrospectionInterface();
151
152 virtual const QDesignerMetaObjectInterface* metaObject(const QObject *object) const = 0;
153 };
154
155 QT_END_NAMESPACE
156
157 #endif // ABSTRACTMETAOBJECT_H
158