CardDatabaseDisplayModel: sort cards by search term only when the current sort column is NameColumn

When the list os sorted using another column, you don’t  need to
compare that column’s value with the searched term
This commit is contained in:
Fabio Bas 2015-04-12 18:43:45 +02:00
parent 013087a4eb
commit 0e203b3ac2

View file

@ -125,7 +125,7 @@ bool CardDatabaseDisplayModel::lessThan(const QModelIndex &left, const QModelInd
QString leftString = sourceModel()->data(left).toString();
QString rightString = sourceModel()->data(right).toString();
if (!cardName.isEmpty())
if (!cardName.isEmpty() && left.column() == CardDatabaseModel::NameColumn)
{
if (leftString.compare(cardName, Qt::CaseInsensitive) == 0) {// exact match should be at top
return true;