QFileSystemModel: fix sorting
authorGiuseppe D'Angelo <dangelog@gmail.com>
Sun, 1 Apr 2012 17:47:56 +0000 (18:47 +0100)
committerQt by Nokia <qt-info@nokia.com>
Sat, 7 Apr 2012 17:45:39 +0000 (19:45 +0200)
commite6e4456de0506aa9896b687dc858eb9ae03d8917
treec8e5ff10dc6d4b8420b4a6ba6e4f40182746916b
parent7ae76153cb53230c426ff26e545e4e98b27ffb59
QFileSystemModel: fix sorting

When sorting a model recursively, the children of a QFileSystemNode
are extracted from their parent in a QHash order; then filtered,
then sorted (using a stable sort) depending on the sorting column.

This means that the order of the children comparing to equal for
the chosen sort are shown in the order they were picked from the
iteration on the QHash, which isn't reliable at all.

Moreover, the criteria used in QFileSystemModelSorter for sorting
are too loose: when sorting by any column but the name, if the result
is "equality", then the file names should be used to determine
the sort order.

This patch removes the stable sort in favour of a full sort,
and fixes the criteria of soring inside QFileSystemModelSorter.

Change-Id: Idd9aece22f2ebbe77ec40d372b43cde4c200ff38
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/widgets/dialogs/qfilesystemmodel.cpp
tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp