[Digikam-devel] QList <->QVector

Marcel Wiesweg marcel.wiesweg at gmx.de
Sun Aug 28 15:34:02 BST 2011



> Maybe we should consider changing QList to QVector in digiKam's code? With
> the patch in the above link Qt will throw a warning when an inefficient
> type is used in the QList container.

QList is much more convenient IMO. Most importantly, Qt API usually takes 
QLists and not QVectors, and a conversion may render any won time to a loss.

I suggest therefore only to think of conversion if profiling proofs that QList 
usage is a problem (*)

There are places in digikam code where this has already been done: Most 
importantly, in DigikamKCategorizedView, and in ImageFilterModel

(*) For our needs, QList will get problematic if the stored object is larger 
than a pointer, and or not movable. In profiling, the construction and 
destruction of the object will then become noticeable. Unfortunately, two 
important and extensively used classes are problematic in this regard: 
QModelIndex and QVariant. But Qt API uses QList everywhere for those, so 
QVector is often not an option.

Marcel



More information about the Digikam-devel mailing list