QHeaderview - many sections removed performance boost.
authorThorbjørn Lund Martsum <tmartsum@gmail.com>
Thu, 16 Feb 2012 09:12:30 +0000 (10:12 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 21 Feb 2012 11:51:46 +0000 (12:51 +0100)
commita4e4c3100780be27070c8916d25a9f7c461d1e11
tree3a9b76d933f8c227a32119bcbf7c1bdb78a65558
parent84438a77ccff294aa8b63dc6b5b11a58cdca0c12
QHeaderview - many sections removed performance boost.

When the QHeaderView model rowCount is decreased then the headerview
needs to remove some sections.

If e.g swapSections had occured then qheaderview before this patch did
a very slow removal by removing one section at a time and for each section
it restored visual and logical indexes.

By temporarily storing the logical index on the section we
can reduce the execution time of this a lot. The old code is only
faster when we remove one index (and is kept for that situation)

There is a complexity in difference (and many factors in our
qheaderview benchmark (the trunc part))

Change-Id: If45eab17fbca3364d458b004980570b5d013e4bd
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/widgets/itemviews/qheaderview.cpp
src/widgets/itemviews/qheaderview_p.h