Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

bool QObject::inherits ( const char *  className  )  const [inline, inherited]

Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.

A class is considered to inherit itself.

Example:

        QTimer *timer = new QTimer;         // QTimer inherits QObject
        timer->inherits("QTimer");          // returns true
        timer->inherits("QObject");         // returns true
        timer->inherits("QAbstractButton"); // returns false

        // QLayout inherits QObject and QLayoutItem
        QLayout *layout = new QLayout;
        layout->inherits("QObject");        // returns true
        layout->inherits("QLayoutItem");    // returns false

( QLayoutItem is not a QObject.)

Consider using qobject_cast<Type *>(object) instead. The method is both faster and safer.

See also:
metaObject(), qobject_cast()

Definition at line 235 of file qobject.h.

Referenced by QFormBuilder::createLayout(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QWindowsXPStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QApplication::font(), QToolButton::initStyleOption(), QAbstractFormBuilder::layoutInfo(), QApplication::palette(), QWindowsXPStyle::pixelMetric(), QPlastiqueStyle::pixelMetric(), QWindowsStyle::pixelMetric(), QWindowsVistaStyle::polish(), QPlastiqueStyle::polish(), QCleanlooksStyle::polish(), QWindowsXPStyle::polish(), QObject::qt_find_obj_child(), QItemDelegate::setEditorData(), QApplication::setFont(), QGraphicsView::setupViewport(), QCleanlooksStyle::styleHint(), QCommonStyle::subControlRect(), QPlastiqueStyle::unpolish(), QWindowsXPStyle::unpolish(), and QCleanlooksStyle::unpolish().

        { return const_cast<QObject *>(this)->qt_metacast(classname) != 0; }


Generated by  Doxygen 1.6.0   Back to index