diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 0fcba3c0c4..f1cf23cc6a 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -384,6 +384,9 @@ 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(). + \sa size() */ diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 890dbd317d..3ce33fb477 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -406,9 +406,6 @@ void QVector::resize(int asize) if (asize > oldAlloc) { // there is not enough space newAlloc = asize; opt = QArrayData::Grow; - } else if (!d->capacityReserved && asize < d->size && asize < (oldAlloc >> 1)) { // we want to shrink - newAlloc = asize; - opt = QArrayData::Grow; } else { newAlloc = oldAlloc; }