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

template<class Key, class T>
Q_INLINE_TEMPLATE QMap< Key, T >::iterator QMap< Key, T >::insert ( const Key &  key,
const T &  value 
) [inline]

Inserts a new item with the key key and a value of value.

If there is already an item with the key key, that item's value is replaced with value.

If there are multiple items with the key key, the most recently inserted item's value is replaced with value.

See also:
insertMulti()

Reimplemented in QMultiMap< Key, T >, QMultiMap< QString, QDBusIntrospection::Signal >, QMultiMap< QObject *, QModelIndex >, QMultiMap< QGraphicsItem *, QGraphicsItem * >, QMultiMap< QString, Node * >, QMultiMap< QByteArray, TokenReplacement * >, QMultiMap< PeerWireClient *, TorrentPiece * >, QMultiMap< QString, QDBusIntrospection::Method >, QMultiMap< QString, QHelpDBReader * >, QMultiMap< QString, QString >, QMultiMap< QObject *, KJS::Bindings::QtConnectionObject * >, and QMultiMap< QString, QtSimpleXml * >.

Definition at line 500 of file qmap.h.

References QMap< Key, T >::detach().

Referenced by QGLContext::colorIndex(), QExtensionFactory::extension(), QComboBox::insertItem(), QAbstractItemModel::itemData(), Q3TextEdit::optimInsertTag(), Q3HttpHeader::parseLine(), QTextFormat::properties(), QMultiMap< QString, QtSimpleXml * >::replace(), and AddressBook::submitContact().

{
    detach();

    QMapData::Node *update[QMapData::LastLevel + 1];
    QMapData::Node *node = mutableFindNode(update, akey);
    if (node == e) {
        node = node_create(d, update, akey, avalue);
    } else {
        concrete(node)->value = avalue;
    }
    return iterator(node);
}


Generated by  Doxygen 1.6.0   Back to index