From 67783026f5c4de6f3c757f967d0e9a6a48295361 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 13 Dec 2011 23:38:57 +0100 Subject: Fix several sort-issues - Treeview: When sorting descending assure that the parent item is still ordered before the child items and not afterwards. - Treeview: When sorting by other roles than names expansionsLevelCompare() had been buggy and resulted in ordering child items below wrong parent items. - General: When sorting by another role than names and the role of two items had been equal a case sensitive sorting of the names had been done. This has been fixed by using the default name sorting as fallback. BUG: 286726 FIXED-IN: 4.8.0 --- src/kitemviews/kfileitemmodel.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/kitemviews/kfileitemmodel.h') diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 20cc75e52..b984ee14c 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -231,7 +231,18 @@ private: QHash retrieveData(const KFileItem& item) const; + /** + * @return True if the item-data \a a should be ordered before the item-data + * \b. The item-data may have different parent-items. + */ bool lessThan(const ItemData* a, const ItemData* b) const; + + /** + * Helper method for lessThan() and expansionLevelsCompare(): Compares + * the passed item-data using m_sortRole as criteria. Both items must + * have the same parent item, otherwise the comparison will be wrong. + */ + int sortRoleCompare(const ItemData* a, const ItemData* b) const; /** * Sorts the items by using lessThan() as comparison criteria. -- cgit v1.3