author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Fri, 16 Apr 2010 11:39:52 +0300 | |
branch | RCL_3 |
changeset 8 | 740e5562c97f |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QOBJECT_H |
|
43 |
#define QOBJECT_H |
|
44 |
||
45 |
#ifndef QT_NO_QOBJECT |
|
46 |
||
47 |
#include <QtCore/qobjectdefs.h> |
|
48 |
#include <QtCore/qstring.h> |
|
49 |
#include <QtCore/qbytearray.h> |
|
50 |
#include <QtCore/qlist.h> |
|
51 |
#ifdef QT_INCLUDE_COMPAT |
|
52 |
#include <QtCore/qcoreevent.h> |
|
53 |
#endif |
|
54 |
#include <QtCore/qscopedpointer.h> |
|
55 |
||
56 |
QT_BEGIN_HEADER |
|
57 |
||
58 |
QT_BEGIN_NAMESPACE |
|
59 |
||
60 |
QT_MODULE(Core) |
|
61 |
||
62 |
class QEvent; |
|
63 |
class QTimerEvent; |
|
64 |
class QChildEvent; |
|
65 |
struct QMetaObject; |
|
66 |
class QVariant; |
|
67 |
class QObjectPrivate; |
|
68 |
class QObject; |
|
69 |
class QThread; |
|
70 |
class QWidget; |
|
71 |
#ifndef QT_NO_REGEXP |
|
72 |
class QRegExp; |
|
73 |
#endif |
|
74 |
#ifndef QT_NO_USERDATA |
|
75 |
class QObjectUserData; |
|
76 |
#endif |
|
77 |
||
78 |
typedef QList<QObject*> QObjectList; |
|
79 |
||
80 |
#if defined Q_CC_MSVC && _MSC_VER < 1300 |
|
81 |
template<typename T> inline T qFindChild(const QObject *o, const QString &name = QString(), T = 0); |
|
82 |
template<typename T> inline QList<T> qFindChildren(const QObject *o, const QString &name = QString(), T = 0); |
|
83 |
# ifndef QT_NO_REGEXP |
|
84 |
template<typename T> inline QList<T> qFindChildren(const QObject *o, const QRegExp &re, T = 0); |
|
85 |
# endif |
|
86 |
#else |
|
87 |
template<typename T> inline T qFindChild(const QObject *, const QString & = QString()); |
|
88 |
template<typename T> inline QList<T> qFindChildren(const QObject *, const QString & = QString()); |
|
89 |
# ifndef QT_NO_REGEXP |
|
90 |
template<typename T> inline QList<T> qFindChildren(const QObject *, const QRegExp &); |
|
91 |
# endif |
|
92 |
#endif |
|
93 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
class |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
Q_CORE_EXPORT |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
#endif |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
QObjectData { |
0 | 99 |
public: |
100 |
virtual ~QObjectData() = 0; |
|
101 |
QObject *q_ptr; |
|
102 |
QObject *parent; |
|
103 |
QObjectList children; |
|
104 |
||
105 |
uint isWidget : 1; |
|
106 |
uint pendTimer : 1; |
|
107 |
uint blockSig : 1; |
|
108 |
uint wasDeleted : 1; |
|
109 |
uint ownObjectName : 1; |
|
110 |
uint sendChildEvents : 1; |
|
111 |
uint receiveChildEvents : 1; |
|
112 |
uint inEventHandler : 1; |
|
113 |
uint inThreadChangeEvent : 1; |
|
114 |
uint hasGuards : 1; //true iff there is one or more QPointer attached to this object |
|
115 |
uint unused : 22; |
|
116 |
int postedEvents; |
|
117 |
QMetaObject *metaObject; // assert dynamic |
|
118 |
}; |
|
119 |
||
120 |
||
121 |
class Q_CORE_EXPORT QObject |
|
122 |
{ |
|
123 |
Q_OBJECT |
|
124 |
Q_PROPERTY(QString objectName READ objectName WRITE setObjectName) |
|
125 |
Q_DECLARE_PRIVATE(QObject) |
|
126 |
||
127 |
public: |
|
128 |
Q_INVOKABLE explicit QObject(QObject *parent=0); |
|
129 |
virtual ~QObject(); |
|
130 |
||
131 |
virtual bool event(QEvent *); |
|
132 |
virtual bool eventFilter(QObject *, QEvent *); |
|
133 |
||
134 |
#ifdef qdoc |
|
135 |
static QString tr(const char *sourceText, const char *comment = 0, int n = -1); |
|
136 |
static QString trUtf8(const char *sourceText, const char *comment = 0, int n = -1); |
|
137 |
virtual const QMetaObject *metaObject() const; |
|
138 |
static const QMetaObject staticMetaObject; |
|
139 |
#endif |
|
140 |
#ifdef QT_NO_TRANSLATION |
|
141 |
static QString tr(const char *sourceText, const char *, int) |
|
142 |
{ return QString::fromLatin1(sourceText); } |
|
143 |
static QString tr(const char *sourceText, const char * = 0) |
|
144 |
{ return QString::fromLatin1(sourceText); } |
|
145 |
#ifndef QT_NO_TEXTCODEC |
|
146 |
static QString trUtf8(const char *sourceText, const char *, int) |
|
147 |
{ return QString::fromUtf8(sourceText); } |
|
148 |
static QString trUtf8(const char *sourceText, const char * = 0) |
|
149 |
{ return QString::fromUtf8(sourceText); } |
|
150 |
#endif |
|
151 |
#endif //QT_NO_TRANSLATION |
|
152 |
||
153 |
QString objectName() const; |
|
154 |
void setObjectName(const QString &name); |
|
155 |
||
156 |
inline bool isWidgetType() const { return d_ptr->isWidget; } |
|
157 |
||
158 |
inline bool signalsBlocked() const { return d_ptr->blockSig; } |
|
159 |
bool blockSignals(bool b); |
|
160 |
||
161 |
QThread *thread() const; |
|
162 |
void moveToThread(QThread *thread); |
|
163 |
||
164 |
int startTimer(int interval); |
|
165 |
void killTimer(int id); |
|
166 |
||
167 |
#ifndef QT_NO_MEMBER_TEMPLATES |
|
168 |
template<typename T> |
|
169 |
inline T findChild(const QString &aName = QString()) const |
|
170 |
{ return qFindChild<T>(this, aName); } |
|
171 |
||
172 |
template<typename T> |
|
173 |
inline QList<T> findChildren(const QString &aName = QString()) const |
|
174 |
{ return qFindChildren<T>(this, aName); } |
|
175 |
||
176 |
#ifndef QT_NO_REGEXP |
|
177 |
template<typename T> |
|
178 |
inline QList<T> findChildren(const QRegExp &re) const |
|
179 |
{ return qFindChildren<T>(this, re); } |
|
180 |
#endif |
|
181 |
#endif |
|
182 |
||
183 |
#ifdef QT3_SUPPORT |
|
184 |
QT3_SUPPORT QObject *child(const char *objName, const char *inheritsClass = 0, |
|
185 |
bool recursiveSearch = true) const; |
|
186 |
QT3_SUPPORT QObjectList queryList(const char *inheritsClass = 0, |
|
187 |
const char *objName = 0, |
|
188 |
bool regexpMatch = true, |
|
189 |
bool recursiveSearch = true) const; |
|
190 |
#endif |
|
191 |
inline const QObjectList &children() const { return d_ptr->children; } |
|
192 |
||
193 |
void setParent(QObject *); |
|
194 |
void installEventFilter(QObject *); |
|
195 |
void removeEventFilter(QObject *); |
|
196 |
||
197 |
||
198 |
static bool connect(const QObject *sender, const char *signal, |
|
199 |
const QObject *receiver, const char *member, Qt::ConnectionType = |
|
200 |
#ifdef qdoc |
|
201 |
Qt::AutoConnection |
|
202 |
#else |
|
203 |
#ifdef QT3_SUPPORT |
|
204 |
Qt::AutoCompatConnection |
|
205 |
#else |
|
206 |
Qt::AutoConnection |
|
207 |
#endif |
|
208 |
#endif |
|
209 |
); |
|
210 |
inline bool connect(const QObject *sender, const char *signal, |
|
211 |
const char *member, Qt::ConnectionType type = |
|
212 |
#ifdef qdoc |
|
213 |
Qt::AutoConnection |
|
214 |
#else |
|
215 |
#ifdef QT3_SUPPORT |
|
216 |
Qt::AutoCompatConnection |
|
217 |
#else |
|
218 |
Qt::AutoConnection |
|
219 |
#endif |
|
220 |
#endif |
|
221 |
) const; |
|
222 |
||
223 |
static bool disconnect(const QObject *sender, const char *signal, |
|
224 |
const QObject *receiver, const char *member); |
|
225 |
inline bool disconnect(const char *signal = 0, |
|
226 |
const QObject *receiver = 0, const char *member = 0) |
|
227 |
{ return disconnect(this, signal, receiver, member); } |
|
228 |
inline bool disconnect(const QObject *receiver, const char *member = 0) |
|
229 |
{ return disconnect(this, 0, receiver, member); } |
|
230 |
||
231 |
void dumpObjectTree(); |
|
232 |
void dumpObjectInfo(); |
|
233 |
||
234 |
#ifndef QT_NO_PROPERTIES |
|
235 |
bool setProperty(const char *name, const QVariant &value); |
|
236 |
QVariant property(const char *name) const; |
|
237 |
QList<QByteArray> dynamicPropertyNames() const; |
|
238 |
#endif // QT_NO_PROPERTIES |
|
239 |
||
240 |
#ifndef QT_NO_USERDATA |
|
241 |
static uint registerUserData(); |
|
242 |
void setUserData(uint id, QObjectUserData* data); |
|
243 |
QObjectUserData* userData(uint id) const; |
|
244 |
#endif // QT_NO_USERDATA |
|
245 |
||
246 |
Q_SIGNALS: |
|
247 |
void destroyed(QObject * = 0); |
|
248 |
||
249 |
public: |
|
250 |
inline QObject *parent() const { return d_ptr->parent; } |
|
251 |
||
252 |
inline bool inherits(const char *classname) const |
|
253 |
{ return const_cast<QObject *>(this)->qt_metacast(classname) != 0; } |
|
254 |
||
255 |
public Q_SLOTS: |
|
256 |
void deleteLater(); |
|
257 |
||
258 |
protected: |
|
259 |
QObject *sender() const; |
|
260 |
int receivers(const char* signal) const; |
|
261 |
||
262 |
virtual void timerEvent(QTimerEvent *); |
|
263 |
virtual void childEvent(QChildEvent *); |
|
264 |
virtual void customEvent(QEvent *); |
|
265 |
||
266 |
virtual void connectNotify(const char *signal); |
|
267 |
virtual void disconnectNotify(const char *signal); |
|
268 |
||
269 |
#ifdef QT3_SUPPORT |
|
270 |
public: |
|
271 |
QT3_SUPPORT_CONSTRUCTOR QObject(QObject *parent, const char *name); |
|
272 |
inline QT3_SUPPORT void insertChild(QObject *o) |
|
273 |
{ if (o) o->setParent(this); } |
|
274 |
inline QT3_SUPPORT void removeChild(QObject *o) |
|
275 |
{ if (o) o->setParent(0); } |
|
276 |
inline QT3_SUPPORT bool isA(const char *classname) const |
|
277 |
{ return qstrcmp(classname, metaObject()->className()) == 0; } |
|
278 |
inline QT3_SUPPORT const char *className() const { return metaObject()->className(); } |
|
279 |
inline QT3_SUPPORT const char *name() const { return objectName().latin1_helper(); } |
|
280 |
inline QT3_SUPPORT const char *name(const char *defaultName) const |
|
281 |
{ QString s = objectName(); return s.isEmpty()?defaultName:s.latin1_helper(); } |
|
282 |
inline QT3_SUPPORT void setName(const char *aName) { setObjectName(QLatin1String(aName)); } |
|
283 |
protected: |
|
284 |
inline QT3_SUPPORT bool checkConnectArgs(const char *signal, |
|
285 |
const QObject *, |
|
286 |
const char *member) |
|
287 |
{ return QMetaObject::checkConnectArgs(signal, member); } |
|
288 |
static inline QT3_SUPPORT QByteArray normalizeSignalSlot(const char *signalSlot) |
|
289 |
{ return QMetaObject::normalizedSignature(signalSlot); } |
|
290 |
#endif |
|
291 |
||
292 |
protected: |
|
293 |
QObject(QObjectPrivate &dd, QObject *parent = 0); |
|
294 |
||
295 |
protected: |
|
296 |
QScopedPointer<QObjectData> d_ptr; |
|
297 |
||
298 |
static const QMetaObject staticQtMetaObject; |
|
299 |
||
300 |
friend struct QMetaObject; |
|
301 |
friend class QApplication; |
|
302 |
friend class QApplicationPrivate; |
|
303 |
friend class QCoreApplication; |
|
304 |
friend class QCoreApplicationPrivate; |
|
305 |
friend class QWidget; |
|
306 |
friend class QThreadData; |
|
307 |
||
308 |
private: |
|
309 |
Q_DISABLE_COPY(QObject) |
|
310 |
Q_PRIVATE_SLOT(d_func(), void _q_reregisterTimers(void *)) |
|
311 |
}; |
|
312 |
||
313 |
inline bool QObject::connect(const QObject *asender, const char *asignal, |
|
314 |
const char *amember, Qt::ConnectionType atype) const |
|
315 |
{ return connect(asender, asignal, this, amember, atype); } |
|
316 |
||
317 |
#ifndef QT_NO_USERDATA |
|
318 |
class Q_CORE_EXPORT QObjectUserData { |
|
319 |
public: |
|
320 |
virtual ~QObjectUserData(); |
|
321 |
}; |
|
322 |
#endif |
|
323 |
||
324 |
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, |
|
325 |
const QMetaObject &mo, QList<void *> *list); |
|
326 |
Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); |
|
327 |
||
328 |
#if defined Q_CC_MSVC && _MSC_VER < 1300 |
|
329 |
||
330 |
template<typename T> |
|
331 |
inline T qFindChild(const QObject *o, const QString &name, T) |
|
332 |
{ return static_cast<T>(qt_qFindChild_helper(o, name, ((T)0)->staticMetaObject)); } |
|
333 |
||
334 |
template<typename T> |
|
335 |
inline QList<T> qFindChildren(const QObject *o, const QString &name, T) |
|
336 |
{ |
|
337 |
QList<T> list; |
|
338 |
union { |
|
339 |
QList<T> *typedList; |
|
340 |
QList<void *> *voidList; |
|
341 |
} u; |
|
342 |
u.typedList = &list; |
|
343 |
qt_qFindChildren_helper(o, name, 0, ((T)0)->staticMetaObject, u.voidList); |
|
344 |
return list; |
|
345 |
} |
|
346 |
||
347 |
template<typename T> |
|
348 |
inline T qFindChild(const QObject *o, const QString &name) |
|
349 |
{ return qFindChild<T>(o, name, T(0)); } |
|
350 |
||
351 |
template<typename T> |
|
352 |
inline T qFindChild(const QObject *o) |
|
353 |
{ return qFindChild<T>(o, QString(), T(0)); } |
|
354 |
||
355 |
template<typename T> |
|
356 |
inline QList<T> qFindChildren(const QObject *o, const QString &name) |
|
357 |
{ return qFindChildren<T>(o, name, T(0)); } |
|
358 |
||
359 |
template<typename T> |
|
360 |
inline QList<T> qFindChildren(const QObject *o) |
|
361 |
{ return qFindChildren<T>(o, QString(), T(0)); } |
|
362 |
||
363 |
#ifndef QT_NO_REGEXP |
|
364 |
template<typename T> |
|
365 |
inline QList<T> qFindChildren(const QObject *o, const QRegExp &re, T) |
|
366 |
{ |
|
367 |
QList<T> list; |
|
368 |
union { |
|
369 |
QList<T> *typedList; |
|
370 |
QList<void *> *voidList; |
|
371 |
} u; |
|
372 |
u.typedList = &list; |
|
373 |
qt_qFindChildren_helper(o, 0, &re, ((T)0)->staticMetaObject, u.voidList); |
|
374 |
return list; |
|
375 |
} |
|
376 |
||
377 |
template<typename T> |
|
378 |
inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) |
|
379 |
{ return qFindChildren<T>(o, re, T(0)); } |
|
380 |
||
381 |
#endif |
|
382 |
||
383 |
#ifdef Q_MOC_RUN |
|
384 |
# define Q_DECLARE_INTERFACE(IFace, IId) Q_DECLARE_INTERFACE(IFace, IId) |
|
385 |
#endif // Q_MOC_RUN |
|
386 |
||
387 |
||
388 |
template <class T> inline const char * qobject_interface_iid() |
|
389 |
{ return 0; } |
|
390 |
||
391 |
template <class T> inline T qobject_cast_helper(QObject *object, T) |
|
392 |
{ return static_cast<T>(((T)0)->staticMetaObject.cast(object)); } |
|
393 |
||
394 |
template <class T> inline T qobject_cast_helper(const QObject *object, T) |
|
395 |
{ return static_cast<T>(const_cast<const QObject *>(((T)0)->staticMetaObject.cast(const_cast<QObject *>(object)))); } |
|
396 |
||
397 |
template <class T> |
|
398 |
inline T qobject_cast(QObject *object) |
|
399 |
{ return qobject_cast_helper<T>(object, T(0)); } |
|
400 |
||
401 |
template <class T> |
|
402 |
inline T qobject_cast(const QObject *object) |
|
403 |
{ return qobject_cast_helper<T>(object, T(0)); } |
|
404 |
||
405 |
#ifndef Q_MOC_RUN |
|
406 |
# define Q_DECLARE_INTERFACE(IFace, IId) \ |
|
407 |
template <> inline const char *qobject_interface_iid<IFace *>() \ |
|
408 |
{ return IId; } \ |
|
409 |
template <> inline IFace *qobject_cast_helper<IFace *>(QObject *object, IFace *) \ |
|
410 |
{ return (IFace *)(object ? object->qt_metacast(IId) : 0); } \ |
|
411 |
template <> inline IFace *qobject_cast_helper<IFace *>(const QObject *object, IFace *) \ |
|
412 |
{ return (IFace *)(object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0); } |
|
413 |
#endif // Q_MOC_RUN |
|
414 |
||
415 |
#else |
|
416 |
||
417 |
template<typename T> |
|
418 |
inline T qFindChild(const QObject *o, const QString &name) |
|
419 |
{ return static_cast<T>(qt_qFindChild_helper(o, name, reinterpret_cast<T>(0)->staticMetaObject)); } |
|
420 |
||
421 |
template<typename T> |
|
422 |
inline QList<T> qFindChildren(const QObject *o, const QString &name) |
|
423 |
{ |
|
424 |
QList<T> list; |
|
425 |
union { |
|
426 |
QList<T> *typedList; |
|
427 |
QList<void *> *voidList; |
|
428 |
} u; |
|
429 |
u.typedList = &list; |
|
430 |
qt_qFindChildren_helper(o, name, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); |
|
431 |
return list; |
|
432 |
} |
|
433 |
||
434 |
#ifndef QT_NO_REGEXP |
|
435 |
template<typename T> |
|
436 |
inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) |
|
437 |
{ |
|
438 |
QList<T> list; |
|
439 |
union { |
|
440 |
QList<T> *typedList; |
|
441 |
QList<void *> *voidList; |
|
442 |
} u; |
|
443 |
u.typedList = &list; |
|
444 |
qt_qFindChildren_helper(o, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); |
|
445 |
return list; |
|
446 |
} |
|
447 |
#endif |
|
448 |
||
449 |
template <class T> |
|
450 |
inline T qobject_cast(QObject *object) |
|
451 |
{ |
|
452 |
#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) |
|
453 |
reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(object)); |
|
454 |
#endif |
|
455 |
return static_cast<T>(reinterpret_cast<T>(0)->staticMetaObject.cast(object)); |
|
456 |
} |
|
457 |
||
458 |
template <class T> |
|
459 |
inline T qobject_cast(const QObject *object) |
|
460 |
{ |
|
461 |
// this will cause a compilation error if T is not const |
|
462 |
register T ptr = static_cast<T>(object); |
|
463 |
Q_UNUSED(ptr); |
|
464 |
||
465 |
#if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK) |
|
466 |
reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(const_cast<QObject *>(object))); |
|
467 |
#endif |
|
468 |
return static_cast<T>(const_cast<QObject *>(reinterpret_cast<T>(0)->staticMetaObject.cast(const_cast<QObject *>(object)))); |
|
469 |
} |
|
470 |
||
471 |
||
472 |
template <class T> inline const char * qobject_interface_iid() |
|
473 |
{ return 0; } |
|
474 |
||
475 |
#ifndef Q_MOC_RUN |
|
476 |
# define Q_DECLARE_INTERFACE(IFace, IId) \ |
|
477 |
template <> inline const char *qobject_interface_iid<IFace *>() \ |
|
478 |
{ return IId; } \ |
|
479 |
template <> inline IFace *qobject_cast<IFace *>(QObject *object) \ |
|
480 |
{ return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : 0)); } \ |
|
481 |
template <> inline IFace *qobject_cast<IFace *>(const QObject *object) \ |
|
482 |
{ return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0)); } |
|
483 |
#endif // Q_MOC_RUN |
|
484 |
||
485 |
#endif |
|
486 |
||
487 |
#ifndef QT_NO_DEBUG_STREAM |
|
488 |
Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *); |
|
489 |
#endif |
|
490 |
||
491 |
QT_END_NAMESPACE |
|
492 |
||
493 |
QT_END_HEADER |
|
494 |
||
495 |
#endif |
|
496 |
||
497 |
#endif // QOBJECT_H |