From ae6ec20349a229b50daccab34a8e27d33c6e1717 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Nov 2022 17:06:22 +0100 Subject: [PATCH] [docs] QList: fix history of resize(n) semantics change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Fabian Kosmale (cherry picked from commit 58ebbb62203ec31e03d3ee0bc58c57de5b3bcce4) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qlist.qdoc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc index 28aa1f271f0..a500d2fe60b 100644 --- a/src/corelib/tools/qlist.qdoc +++ b/src/corelib/tools/qlist.qdoc @@ -422,14 +422,19 @@ */ /*! \fn template void QList::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() */