summaryrefslogtreecommitdiffstats
path: root/CategorizedProxyModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CategorizedProxyModel.cpp')
-rw-r--r--CategorizedProxyModel.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/CategorizedProxyModel.cpp b/CategorizedProxyModel.cpp
index 2b54ce1b..e4a7563a 100644
--- a/CategorizedProxyModel.cpp
+++ b/CategorizedProxyModel.cpp
@@ -8,5 +8,14 @@ CategorizedProxyModel::CategorizedProxyModel(QObject *parent)
}
bool CategorizedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
- return left.data(CategorizedView::CategoryRole).toString() < right.data(CategorizedView::CategoryRole).toString();
+ const QString leftCategory = left.data(CategorizedView::CategoryRole).toString();
+ const QString rightCategory = right.data(CategorizedView::CategoryRole).toString();
+ if (leftCategory == rightCategory)
+ {
+ return left.row() < right.row();
+ }
+ else
+ {
+ return leftCategory < rightCategory;
+ }
}