Optimize loop; refers #910

This commit is contained in:
Fabio Bas 2015-04-08 12:52:02 +02:00
parent 869d89dfdd
commit 8f3421204e

View file

@ -307,11 +307,12 @@ void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order)
QVector<QPair<int, int> > 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);
}