cf6bccbcf5
QlistWidgets with sorting enabled do not sort stable. A re-sort is triggered when any Qt::ItemDataRole is changed and not only when Qt::DisplayRole is changed. Due to an unstable optimization, the changed element gets inserted at the beginning of their respective "equivalence group". This patch disables the optimization and ensures stable sorting with std::stable_sort. Sorting is only performed, if the subset of changed items in the range [begin, end] is not already sorted in the whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check. Limits / side effect: The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets. Task-number: QTBUG-113123 Pick-to: 6.5 6.6 Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> |
||
---|---|---|
.. | ||
.gitignore | ||
CMakeLists.txt | ||
tst_qlistwidget.cpp |