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

QObject * QExtensionFactory::extension ( QObject object,
const QString iid 
) const [virtual]

Returns the extension specified by iid for the given object.

See also:
createExtension()

Implements QAbstractExtensionFactory.

Definition at line 123 of file default_extensionfactory.cpp.

References QObject::connect(), QMap< Key, T >::contains(), QHash< Key, T >::contains(), createExtension(), QObject::destroyed(), QMap< Key, T >::insert(), QHash< Key, T >::insert(), and QMap< Key, T >::value().

{
    if (!object)
        return 0;

    QPair<QString, QObject*> key = qMakePair(iid, object);
    if (!m_extensions.contains(key)) {
        if (QObject *ext = createExtension(object, iid, const_cast<QExtensionFactory*>(this))) {
            connect(ext, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
            m_extensions.insert(key, ext);
        }
    }

    if (!m_extended.contains(object)) {
        connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
        m_extended.insert(object, true);
    }

    return m_extensions.value(key);
}


Generated by  Doxygen 1.6.0   Back to index