diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-01-31 22:51:45 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-01-31 22:51:45 +0100 |
commit | 3fb7a0faf069fdc5a4f14a12dfd76c43819c3378 (patch) | |
tree | e2379ae9619152fd9e378ad9ee64256a5d5d6647 /GroupedProxyModel.cpp | |
parent | c47933d95cae407a99acfbbb941655f7cd52e1ae (diff) | |
download | MultiMC-3fb7a0faf069fdc5a4f14a12dfd76c43819c3378.tar MultiMC-3fb7a0faf069fdc5a4f14a12dfd76c43819c3378.tar.gz MultiMC-3fb7a0faf069fdc5a4f14a12dfd76c43819c3378.tar.lz MultiMC-3fb7a0faf069fdc5a4f14a12dfd76c43819c3378.tar.xz MultiMC-3fb7a0faf069fdc5a4f14a12dfd76c43819c3378.zip |
Reformat, Rename, Redo
Diffstat (limited to 'GroupedProxyModel.cpp')
-rw-r--r-- | GroupedProxyModel.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/GroupedProxyModel.cpp b/GroupedProxyModel.cpp new file mode 100644 index 00000000..ab00a412 --- /dev/null +++ b/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(CategorizedViewRoles::CategoryRole).toString(); + const QString rightCategory = right.data(CategorizedViewRoles::CategoryRole).toString(); + if (leftCategory == rightCategory) + { + return left.row() < right.row(); + } + else + { + return leftCategory < rightCategory; + } +} |