Merge pull request #928 from ctrlaltca/optimize_loop
Optimize loop; refers #910
This commit is contained in:
commit
0b4b8e85e8
1 changed files with 2 additions and 1 deletions
|
@ -307,11 +307,12 @@ void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order)
|
||||||
QVector<QPair<int, int> > sortResult = node->sort(order);
|
QVector<QPair<int, int> > sortResult = node->sort(order);
|
||||||
|
|
||||||
QModelIndexList from, to;
|
QModelIndexList from, to;
|
||||||
|
int columns = columnCount();
|
||||||
for (int i = sortResult.size() - 1; i >= 0; --i) {
|
for (int i = sortResult.size() - 1; i >= 0; --i) {
|
||||||
const int fromRow = sortResult[i].first;
|
const int fromRow = sortResult[i].first;
|
||||||
const int toRow = sortResult[i].second;
|
const int toRow = sortResult[i].second;
|
||||||
AbstractDecklistNode *temp = node->at(toRow);
|
AbstractDecklistNode *temp = node->at(toRow);
|
||||||
for (int j = 0; j < columnCount(); ++j) {
|
for (int j = 0; j < columns; ++j) {
|
||||||
from << createIndex(fromRow, j, temp);
|
from << createIndex(fromRow, j, temp);
|
||||||
to << createIndex(toRow, j, temp);
|
to << createIndex(toRow, j, temp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue