Commit 0e203b3a authored by Fabio Bas's avatar Fabio Bas
Browse files

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
parent 013087a4
...@@ -125,7 +125,7 @@ bool CardDatabaseDisplayModel::lessThan(const QModelIndex &left, const QModelInd ...@@ -125,7 +125,7 @@ bool CardDatabaseDisplayModel::lessThan(const QModelIndex &left, const QModelInd
QString leftString = sourceModel()->data(left).toString(); QString leftString = sourceModel()->data(left).toString();
QString rightString = sourceModel()->data(right).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 if (leftString.compare(cardName, Qt::CaseInsensitive) == 0) {// exact match should be at top
return true; return true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment