Qt 4.8
qmetaobject.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QMETAOBJECT_H
43 #define QMETAOBJECT_H
44 
45 #include <QtCore/qobjectdefs.h>
46 #include <QtCore/qvariant.h>
47 
49 
51 
52 QT_MODULE(Core)
53 
54 template <typename T> class QList;
55 
57 {
58 public:
59  inline QMetaMethod() : mobj(0),handle(0) {}
60 
61  const char *signature() const;
62  const char *typeName() const;
63  QList<QByteArray> parameterTypes() const;
64  QList<QByteArray> parameterNames() const;
65  const char *tag() const;
66  enum Access { Private, Protected, Public };
67  Access access() const;
68  enum MethodType { Method, Signal, Slot, Constructor };
69  MethodType methodType() const;
70  enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 };
71  int attributes() const;
72  int methodIndex() const;
73  int revision() const;
74 
75  inline const QMetaObject *enclosingMetaObject() const { return mobj; }
76 
77  bool invoke(QObject *object,
78  Qt::ConnectionType connectionType,
79  QGenericReturnArgument returnValue,
89  QGenericArgument val9 = QGenericArgument()) const;
90  inline bool invoke(QObject *object,
91  QGenericReturnArgument returnValue,
101  QGenericArgument val9 = QGenericArgument()) const
102  {
103  return invoke(object, Qt::AutoConnection, returnValue,
104  val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
105  }
106  inline bool invoke(QObject *object,
107  Qt::ConnectionType connectionType,
117  QGenericArgument val9 = QGenericArgument()) const
118  {
119  return invoke(object, connectionType, QGenericReturnArgument(),
120  val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
121  }
122  inline bool invoke(QObject *object,
132  QGenericArgument val9 = QGenericArgument()) const
133  {
134  return invoke(object, Qt::AutoConnection, QGenericReturnArgument(),
135  val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
136  }
137 
138 private:
141  friend struct QMetaObject;
142  friend struct QMetaObjectPrivate;
143  friend class QObject;
144 };
146 
148 {
149 public:
150  inline QMetaEnum() : mobj(0),handle(0) {}
151 
152  const char *name() const;
153  bool isFlag() const;
154 
155  int keyCount() const;
156  const char *key(int index) const;
157  int value(int index) const;
158 
159  const char *scope() const;
160 
161  int keyToValue(const char *key) const;
162  const char* valueToKey(int value) const;
163  int keysToValue(const char * keys) const;
164  QByteArray valueToKeys(int value) const;
165 
166  inline const QMetaObject *enclosingMetaObject() const { return mobj; }
167 
168  inline bool isValid() const { return name() != 0; }
169 private:
172  friend struct QMetaObject;
173 };
175 
177 {
178 public:
179  QMetaProperty();
180 
181  const char *name() const;
182  const char *typeName() const;
183  QVariant::Type type() const;
184  int userType() const;
185  int propertyIndex() const;
186 
187  bool isReadable() const;
188  bool isWritable() const;
189  bool isResettable() const;
190  bool isDesignable(const QObject *obj = 0) const;
191  bool isScriptable(const QObject *obj = 0) const;
192  bool isStored(const QObject *obj = 0) const;
193  bool isEditable(const QObject *obj = 0) const;
194  bool isUser(const QObject *obj = 0) const;
195  bool isConstant() const;
196  bool isFinal() const;
197 
198  bool isFlagType() const;
199  bool isEnumType() const;
200  QMetaEnum enumerator() const;
201 
202  bool hasNotifySignal() const;
203  QMetaMethod notifySignal() const;
204  int notifySignalIndex() const;
205 
206  int revision() const;
207 
208  QVariant read(const QObject *obj) const;
209  bool write(QObject *obj, const QVariant &value) const;
210  bool reset(QObject *obj) const;
211 
212  bool hasStdCppSet() const;
213  inline bool isValid() const { return isReadable(); }
214  inline const QMetaObject *enclosingMetaObject() const { return mobj; }
215 
216 private:
219  int idx;
221  friend struct QMetaObject;
222 };
223 
225 {
226 public:
227  inline QMetaClassInfo() : mobj(0),handle(0) {}
228  const char *name() const;
229  const char *value() const;
230  inline const QMetaObject *enclosingMetaObject() const { return mobj; }
231 private:
234  friend struct QMetaObject;
235 };
237 
239 
241 
242 #endif // QMETAOBJECT_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
int type
Definition: qmetatype.cpp:239
The QMetaEnum class provides meta-data about an enumerator.
Definition: qmetaobject.h:147
bool invoke(QObject *object, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument()) const
Definition: qmetaobject.h:122
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
bool invoke(QObject *object, Qt::ConnectionType connectionType, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument()) const
Definition: qmetaobject.h:106
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
bool isValid() const
Returns true if this enum is valid (has a name); otherwise returns false.
Definition: qmetaobject.h:168
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
Access
This enum describes the access level of a method, following the conventions used in C++...
Definition: qmetaobject.h:66
bool isValid() const
Returns true if this property is valid (readable); otherwise returns false.
Definition: qmetaobject.h:213
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
The QGenericReturnArgument class is an internal helper class for marshalling arguments.
Definition: qobjectdefs.h:269
QStringList keys
The QGenericArgument class is an internal helper class for marshalling arguments. ...
Definition: qobjectdefs.h:256
ConnectionType
Definition: qnamespace.h:1469
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
int access(const char *, int)
const char * typeName
Definition: qmetatype.cpp:239
const char * name
const QMetaObject * enclosingMetaObject() const
Definition: qmetaobject.h:75
unsigned int uint
Definition: qglobal.h:996
Type
This enum type defines the types of variable that a QVariant can contain.
Definition: qvariant.h:95
uint handle
Definition: qmetaobject.h:171
const QMetaObject * mobj
Definition: qmetaobject.h:170
const QMetaObject * enclosingMetaObject() const
Definition: qmetaobject.h:230
#define Q_CORE_EXPORT
Definition: qglobal.h:1449
Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE)
const QMetaObject * mobj
Definition: qmetaobject.h:232
The QMetaClassInfo class provides additional information about a class.
Definition: qmetaobject.h:224
const QMetaObject * enclosingMetaObject() const
Definition: qmetaobject.h:214
int key
const QMetaObject * enclosingMetaObject() const
Definition: qmetaobject.h:166
quint16 index
QMetaEnum menum
Definition: qmetaobject.h:220
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:176
const QMetaObject * mobj
Definition: qmetaobject.h:139
bool invoke(QObject *object, QGenericReturnArgument returnValue, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument()) const
Definition: qmetaobject.h:90
#define QT_END_HEADER
Definition: qglobal.h:137
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:56
const QMetaObject * mobj
Definition: qmetaobject.h:217
The QList class is a template class that provides lists.
Definition: qdatastream.h:62