Merge pull request #928 from ctrlaltca/optimize_loop

Optimize loop; refers #910
This commit is contained in:
ctrlaltca 2015-04-08 12:53:27 +02:00
commit 0b4b8e85e8

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);
}