summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-11-02 17:06:22 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-28 23:27:37 +0000
commitae6ec20349a229b50daccab34a8e27d33c6e1717 (patch)
treeb69ba17dec86db882fb9103133cf90532f12f719
parent7eb8a71c94baf6aabcb5a48f04aacfa9b7f7b1f4 (diff)
downloadqtbase-ae6ec20349a229b50daccab34a8e27d33c6e1717.tar.gz
[docs] QList: fix history of resize(n) semantics change
The description was copied from QVector, and doesn't exactly fit QList. For QList, the function is \since 6.0 when QList became QVector, not in Qt 5.7, as indicated. Be more precise. Amends 13293d3308c04d22bc2928e8991f47744560e085, which changed the docs for clear(). Fixes: QTBUG-112334 Change-Id: I457a1f699ddcdcdad2f1daf88f577007c136ee8f Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 58ebbb62203ec31e03d3ee0bc58c57de5b3bcce4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/tools/qlist.qdoc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index 28aa1f271f..a500d2fe60 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -422,14 +422,19 @@
*/
/*! \fn template <typename T> void QList<T>::resize(qsizetype size)
+ \since 6.0
Sets the size of the list to \a size. If \a size is greater than the
current size, elements are added to the end; the new elements are
initialized with a \l{default-constructed value}. If \a size is less
than the current size, elements are removed from the end.
- Since Qt 5.6, resize() doesn't shrink the capacity anymore.
- To shed excess capacity, use squeeze().
+ If this list is not shared, the capacity() is preserved. Use squeeze()
+ to shed excess capacity.
+
+ \note In Qt versions prior to 5.7 (for QVector; QList lacked a resize()
+ until 6.0), this function released the memory used by the list instead of
+ preserving the capacity.
\sa size()
*/