From 8f3421204e6d21ca5621eecaf1cc057385d9d86f Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 8 Apr 2015 12:52:02 +0200 Subject: [PATCH] Optimize loop; refers #910 --- cockatrice/src/decklistmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/decklistmodel.cpp b/cockatrice/src/decklistmodel.cpp index 8a3b8b0f..039db364 100644 --- a/cockatrice/src/decklistmodel.cpp +++ b/cockatrice/src/decklistmodel.cpp @@ -307,11 +307,12 @@ void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order) QVector > sortResult = node->sort(order); QModelIndexList from, to; + int columns = columnCount(); for (int i = sortResult.size() - 1; i >= 0; --i) { const int fromRow = sortResult[i].first; const int toRow = sortResult[i].second; AbstractDecklistNode *temp = node->at(toRow); - for (int j = 0; j < columnCount(); ++j) { + for (int j = 0; j < columns; ++j) { from << createIndex(fromRow, j, temp); to << createIndex(toRow, j, temp); }