summaryrefslogtreecommitdiffstats
path: root/depends/groupview/GroupedProxyModel.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-02-04 00:53:05 +0100
committerPetr Mrázek <peterix@gmail.com>2014-02-04 00:53:05 +0100
commitb82eb5873e99dce6aec735b08929e3add52e53e7 (patch)
treef8b60861bc5006cc989e65b87b22498f2b1d4412 /depends/groupview/GroupedProxyModel.cpp
parenta17caba2c9c2aa5960581db01e4b66472a9c019c (diff)
parent946d49675cb4725c31ab49a51f3bcae302f89a19 (diff)
downloadMultiMC-b82eb5873e99dce6aec735b08929e3add52e53e7.tar
MultiMC-b82eb5873e99dce6aec735b08929e3add52e53e7.tar.gz
MultiMC-b82eb5873e99dce6aec735b08929e3add52e53e7.tar.lz
MultiMC-b82eb5873e99dce6aec735b08929e3add52e53e7.tar.xz
MultiMC-b82eb5873e99dce6aec735b08929e3add52e53e7.zip
Add 'depends/groupview/' from commit '946d49675cb4725c31ab49a51f3bcae302f89a19'
git-subtree-dir: depends/groupview git-subtree-mainline: a17caba2c9c2aa5960581db01e4b66472a9c019c git-subtree-split: 946d49675cb4725c31ab49a51f3bcae302f89a19
Diffstat (limited to 'depends/groupview/GroupedProxyModel.cpp')
-rw-r--r--depends/groupview/GroupedProxyModel.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/depends/groupview/GroupedProxyModel.cpp b/depends/groupview/GroupedProxyModel.cpp
new file mode 100644
index 00000000..57d7ff5c
--- /dev/null
+++ b/depends/groupview/GroupedProxyModel.cpp
@@ -0,0 +1,21 @@
+#include "GroupedProxyModel.h"
+
+#include "GroupView.h"
+
+GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
+{
+}
+
+bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+ const QString leftCategory = left.data(GroupViewRoles::GroupRole).toString();
+ const QString rightCategory = right.data(GroupViewRoles::GroupRole).toString();
+ if (leftCategory == rightCategory)
+ {
+ return left.row() < right.row();
+ }
+ else
+ {
+ return leftCategory < rightCategory;
+ }
+}