Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/kernel/qobject.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    326326Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo);
    327327
    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 
    417328template<typename T>
    418329inline T qFindChild(const QObject *o, const QString &name)
     
    483394#endif // Q_MOC_RUN
    484395
    485 #endif
    486 
    487396#ifndef QT_NO_DEBUG_STREAM
    488397Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
Note: See TracChangeset for help on using the changeset viewer.