Changeset 846 for trunk/src/corelib/kernel/qobject.h
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/corelib/kernel/qobject.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 326 326 Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); 327 327 328 #if defined Q_CC_MSVC && _MSC_VER < 1300329 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_REGEXP364 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 #endif382 383 #ifdef Q_MOC_RUN384 # define Q_DECLARE_INTERFACE(IFace, IId) Q_DECLARE_INTERFACE(IFace, IId)385 #endif // Q_MOC_RUN386 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_RUN406 # 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_RUN414 415 #else416 417 328 template<typename T> 418 329 inline T qFindChild(const QObject *o, const QString &name) … … 483 394 #endif // Q_MOC_RUN 484 395 485 #endif486 487 396 #ifndef QT_NO_DEBUG_STREAM 488 397 Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
Note:
See TracChangeset
for help on using the changeset viewer.