summaryrefslogtreecommitdiffstats
path: root/CategorizedProxyModel.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2013-12-26 21:16:03 +0100
committerJan Dalheimer <jan@dalheimer.de>2013-12-26 21:16:03 +0100
commit525f508d94120feae89ee1d1bd960625ab14ed37 (patch)
treef9e113ac5a3e7fcf86c226ae7c7176d553993a84 /CategorizedProxyModel.cpp
parentccbf341dc8d8e515d9cf918bff7ff9435c477847 (diff)
downloadMultiMC-525f508d94120feae89ee1d1bd960625ab14ed37.tar
MultiMC-525f508d94120feae89ee1d1bd960625ab14ed37.tar.gz
MultiMC-525f508d94120feae89ee1d1bd960625ab14ed37.tar.lz
MultiMC-525f508d94120feae89ee1d1bd960625ab14ed37.tar.xz
MultiMC-525f508d94120feae89ee1d1bd960625ab14ed37.zip
Loads of stuff, amongst others d&d and many bug fixes
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;
+ }
}