[Development] Proposal: Deprecate QVector in Qt 6

André Somers andre at familiesomers.nl
Thu Apr 23 14:04:51 CEST 2020

On 23-04-20 12:49, Mitch Curtis wrote:
>> -----Original Message-----
>> From: Development <development-bounces at qt-project.org> On Behalf Of
>> André Somers
>> Sent: Thursday, 23 April 2020 12:04 PM
>> To: Jaroslaw Kobus <Jaroslaw.Kobus at qt.io>; development at qt-project.org
>> Subject: Re: [Development] Proposal: Deprecate QVector in Qt 6
>> Hi,
>> On 23-04-20 11:58, Jaroslaw Kobus wrote:
>>> There are cases, where the name of the function contains the "list", like:
>>> QList<QMdiSubWindow *>
>> QMdiArea::subWindowList(QMdiArea::WindowOrder
>>> order = CreationOrder) const; QList<QPair<qreal, QPointF> >
>>> QGraphicsItemAnimation::translationList() const;
>>> QList<QLowEnergyAdvertisingParameters::AddressInfo>
>> QLowEnergyAdvertisingParameters::whiteList() const; etc...
>>> So, subWindowList() returning the vector?
>> Yeah. Not ideal, but not a big deal either in these cases, especially the last
>> one which uses a common term "whiteList". I do see an issue with API like
>> QSet::toList(). That would obviously need to be deprecated in favor of a
>> QSet::toVector().
> QSet::toVector() was rejected in favour of range constructors: https://bugreports.qt.io/browse/QTBUG-71067


return QVector<TypeExplicitlyNeeded>(set.begin(), set.end());

is obviously easier to write and understand than:

return set.toVector();

Got it.


More information about the Development mailing list