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

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.


        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 220 of file qobject.h.

Referenced by QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QWindowsXPStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QApplication::font(), QApplication::palette(), QPlastiqueStyle::pixelMetric(), QPlastiqueStyle::polish(), QCleanlooksStyle::polish(), QWindowsXPStyle::polish(), QObject::qt_find_obj_child(), QItemDelegate::setEditorData(), QApplication::setFont(), QGraphicsView::setupViewport(), 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