- Qt 5.15
- Qt Core
- C++ Classes
- QHash
- Qt 5.15.18 Reference Documentation

# Obsolete Members for QHash

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

## Public Functions

`(obsolete)` iterator | insertMulti(const Key &key, const T &value)
`(obsolete)` QList<Key> | uniqueKeys() const
`(obsolete)` QHash<K, V> & | unite(const QHash<K, V> &other)
`(obsolete)` QList<T> | values(const Key &key) const

## Member Function Documentation

### iterator QHash::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.

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

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

This function is obsolete. Use QMultiHash or QMultiMap instead.

See also insert() and values().

### QList<Key> QHash::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 QMultiHash for storing multiple values with the same key.

Returns a list containing all the keys in the map. 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 QMultiHash::uniqueKeys().

### QHash<K, V> &QHash::unite(const QHash<K, V> &other)

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

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

### QList<T> QHash::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 QMultiHash for storing multiple values with the same key.

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

See also count() and insertMulti().