diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-02-04 00:53:05 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-02-04 00:53:05 +0100 |
commit | b82eb5873e99dce6aec735b08929e3add52e53e7 (patch) | |
tree | f8b60861bc5006cc989e65b87b22498f2b1d4412 /depends/groupview/GroupedProxyModel.cpp | |
parent | a17caba2c9c2aa5960581db01e4b66472a9c019c (diff) | |
parent | 946d49675cb4725c31ab49a51f3bcae302f89a19 (diff) | |
download | PrismLauncher-b82eb5873e99dce6aec735b08929e3add52e53e7.tar.gz PrismLauncher-b82eb5873e99dce6aec735b08929e3add52e53e7.tar.bz2 PrismLauncher-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.cpp | 21 |
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; + } +} |