qt6-bb10/tests/auto/widgets/itemviews
Wladimir Leuschner cf6bccbcf5 Ensure stable sort in QListWidget
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>
2023-09-26 16:45:11 +00:00
..
qabstractitemview QAbstractItemDelegate: Update spinbox editor value before committing 2023-09-25 15:12:05 +02:00
qcolumnview CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qdatawidgetmapper CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qfileiconprovider CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qheaderview CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qitemdelegate CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qitemeditorfactory CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qitemview CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qlistview QAbstractScrollArea: Don't include size of invisible scrollbars 2023-07-11 01:34:19 +02:00
qlistwidget Ensure stable sort in QListWidget 2023-09-26 16:45:11 +00:00
qtableview CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtablewidget QAbstractScrollArea: Don't include size of invisible scrollbars 2023-07-11 01:34:19 +02:00
qtreeview CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
qtreewidget QAbstractScrollArea: Don't include size of invisible scrollbars 2023-07-11 01:34:19 +02:00
qtreewidgetitemiterator CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00