[Development] QList for Qt 6

Konstantin Tokarev annulen at yandex.ru
Fri May 24 13:36:40 CEST 2019



24.05.2019, 14:27, "Konstantin Tokarev" <annulen at yandex.ru>:
> Actually, clazy provides related checks "inefficient-qlist". I think following plan can work:
>
> 1. Implement opposite "replace-efficient-qlist-to-qvector" check in clazy which finds QList<T>
> where sizeof(T) <= sizeof(void*) and T is movable, and allows automatic replacement with QVector
>
> 2. Apply this transformation to all public and private Qt APIs, and refrain from QList replacements
> in places which are not sanctioned by tool.

2a. Replace remaining uses of QList in public and private APIs with typedefs/aliases, like
QList<QSomething*> -> QSomethingList

>
> 3. Implement clazy check "inefficient-qvector-insert" which warns when prepend/push_front and
> insert into middle are used with QVector.
>
> Algorithm of porting to Qt 6 could be:
>
> 1. Run inefficient-qvector-insert over code base and store results
> 2. Apply replace-efficient-qlist-to-qvector to whole code base
> 3. Run inefficient-qvector-insert again and make a diff with step 1, and suggest user to check
> these cases carefully for possible reference issues and performance regressions
>
> Results:
> 1. Do a big chunk of worldwide QList elemination without compatibility hacks and with relatively
> low risk
> 2. Users should finally get the message that QList is not the go-to container preferred in most cases.
>
> Porting other part of QList usages can be delayed to Qt7.
-- 
Regards,
Konstantin



More information about the Development mailing list