diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-11-02 17:06:22 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-11-27 17:14:28 +0100 |
commit | 13293d3308c04d22bc2928e8991f47744560e085 (patch) | |
tree | cfb7f86f5c524a0ce6f60961c1e75e513edc41f6 | |
parent | d1a37ab0997fbe393fb9cca7158dfa59041f165d (diff) |
[docs] QList: fix history of clear() semantics change
The description was copied from QVector, and doesn't exactly fit
QList. For QList, the behavior changed in Qt 6.0 when QList became
QVector, not in Qt 5.7, as indicated.
Be more precise.
Pick-to: 6.4 6.2
Change-Id: I4029d83128ec205f628125d78394e8ee79cc221f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qlist.qdoc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc index e1c917bbc4..f3b501a0e9 100644 --- a/src/corelib/tools/qlist.qdoc +++ b/src/corelib/tools/qlist.qdoc @@ -549,17 +549,14 @@ Removes all the elements from the list. - \note Until Qt 5.6, this also released the memory used by - the list. From Qt 5.7, the capacity is preserved. To shed - all capacity, swap with a default-constructed list: - \code - QList<T> l ...; - QList<T>().swap(l); - Q_ASSERT(l.capacity() == 0); - \endcode - or call 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) and 6.0 (for QList), this + function released the memory used by the list instead of preserving the + capacity. - \sa squeeze() + \sa resize(), squeeze() */ /*! \fn template <typename T> const T &QList<T>::at(qsizetype i) const |