From 0e203b3ac2be4e18dfe977e2826224d50cb6f241 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 12 Apr 2015 18:43:45 +0200 Subject: [PATCH] CardDatabaseDisplayModel: sort cards by search term only when the current sort column is NameColumn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the list os sorted using another column, you don’t need to compare that column’s value with the searched term --- cockatrice/src/carddatabasemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/carddatabasemodel.cpp b/cockatrice/src/carddatabasemodel.cpp index 341542df..4fb1c790 100644 --- a/cockatrice/src/carddatabasemodel.cpp +++ b/cockatrice/src/carddatabasemodel.cpp @@ -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;