summaryrefslogtreecommitdiffstats
path: root/GroupedProxyModel.cpp
blob: ab00a412b8f35edea2812e69a031c1d081d7d45f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
	}
}