Obsolete Members for QMap

The following members of class QMap are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

(obsolete) QMap::iterator insertMulti(const Key &key, const T &value)
(obsolete) QMap::iterator insertMulti(QMap::const_iterator pos, const Key &key, const T &value)
(obsolete) QList<Key> uniqueKeys() const
(obsolete) QMap<Key, T> &unite(const QMap<Key, T> &other)
(obsolete) QList<T> values(const Key &key) const

Member Function Documentation

QMap::iterator QMap::insertMulti(const Key &key, const T &value)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use QMultiMap for storing multiple values with the same key.

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

If there is already an item with the same key in the map, this function will simply create a new one. (This behavior is different from insert(), which overwrites the value of an existing item.)

See also QMultiMap::insert().

QMap::iterator QMap::insertMulti(QMap::const_iterator pos, const Key &key, const T &value)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Use QMultiMap for storing multiple values with the same key. Inserts a new item with the key key and value value and with hint pos suggesting where to do the insert.

If constBegin() is used as hint it indicates that the key is less than any key in the map while constEnd() suggests that the key is larger than any key in the map. Otherwise the hint should meet the condition (pos - 1).key() < key <= pos.key(). If the hint pos is wrong it is ignored and a regular insertMulti is done.

If there is already an item with the same key in the map, this function will simply create a new one.

Note: Be careful with the hint. Providing an iterator from an older shared instance might crash but there is also a risk that it will silently corrupt both the map and the pos map.

This function was introduced in Qt 5.1.

See also QMultiMap::insert().

QList<Key> QMap::uniqueKeys() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use QMultiMap for storing multiple values with the same key.

Returns a list containing all the keys in the map in ascending order. Keys that occur multiple times in the map (because items were inserted with insertMulti(), or unite() was used) occur only once in the returned list.

This function was introduced in Qt 4.2.

See also QMultiMap::uniqueKeys().

QMap<Key, T> &QMap::unite(const QMap<Key, T> &other)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use QMultiMap for storing multiple values with the same key.

Inserts all the items in the other map into this map. If a key is common to both maps, the resulting map will contain the key multiple times.

See also QMultiMap::unite().

QList<T> QMap::values(const Key &key) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Use QMultiMap for maps storing multiple values with the same key.

Returns a list containing all the values associated with key key, from the most recently inserted to the least recently inserted one.

See also QMultiMap::values().

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.