summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-05-28 19:39:27 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-05-29 13:44:10 +0200
commitf69005687c333741925a437ffbea3cec24c0d46b (patch)
treef06d7fa50c1278dc2e466248544a0c7b73fcf3cf /src
parentee61ea399b0d455c568f97095fee5757bd55cf68 (diff)
QMap: remove more docs referring to multiple values for the same key
Such semantics have been dropped from Qt 6. Change-Id: I12f3478833afafa34f9075faf9ed030d06cd86f9 Pick-to: 6.2 6.3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp16
-rw-r--r--src/corelib/tools/qmap.qdoc25
2 files changed, 4 insertions, 37 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
index d429374f4e..552b7be80a 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
@@ -72,22 +72,6 @@ map.insert("plenty", 2000);
//! [9]
-//! [10]
-QList<int> values = map.values("plenty");
-for (int i = 0; i < values.size(); ++i)
- cout << values.at(i) << Qt::endl;
-//! [10]
-
-
-//! [11]
-QMap<QString, int>::iterator i = map.find("plenty");
-while (i != map.end() && i.key() == "plenty") {
- cout << i.value() << Qt::endl;
- ++i;
-}
-//! [11]
-
-
//! [12]
QMap<QString, int> map;
...
diff --git a/src/corelib/tools/qmap.qdoc b/src/corelib/tools/qmap.qdoc
index 6c7d7bcbc4..2e767acc4a 100644
--- a/src/corelib/tools/qmap.qdoc
+++ b/src/corelib/tools/qmap.qdoc
@@ -87,24 +87,14 @@
The items are traversed in ascending key order.
- Normally, a QMap allows only one value per key. If you call
+ A QMap allows only one value per key. If you call
insert() with a key that already exists in the QMap, the
previous value will be erased. For example:
\snippet code/src_corelib_tools_qmap.cpp 9
However, you can store multiple values per key by using
- QMultiMap. If you want
- to retrieve all the values for a single key, you can use
- values(const Key &key), which returns a QList<T>:
-
- \snippet code/src_corelib_tools_qmap.cpp 10
-
- Another approach is to call
- find() to get the STL-style iterator for the first item with a
- key and iterate from there:
-
- \snippet code/src_corelib_tools_qmap.cpp 11
+ QMultiMap.
If you only need to extract the values from a map (not the keys),
you can also use \l{foreach}:
@@ -318,9 +308,7 @@
the value associated with it.
If the item does not exist in the map, the function simply
- returns a \l{default-constructed value}. If there are multiple
- items for \a key in the map, only the most recently inserted one
- is removed and returned.
+ returns a \l{default-constructed value}.
If you don't use the return value, remove() is more efficient.
@@ -370,9 +358,7 @@
If the map contains no item with key \a key, the function inserts
a \l{default-constructed value} into the map with key \a key, and
- returns a reference to it. If the map contains multiple items
- with key \a key, this function returns a reference to the most
- recently inserted value.
+ returns a reference to it.
\sa insert(), value()
*/
@@ -772,9 +758,6 @@
If a key is common to both maps, its value will be replaced with
the value stored in \a map.
- \note If \a map contains multiple entries with the same key then the
- final value of the key is undefined.
-
\sa QMultiMap::insert()
*/