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