mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Don't have decklist sort behavior rely on column order
This commit is contained in:
parent
e99c1bbe6d
commit
68c0932a2f
3 changed files with 26 additions and 13 deletions
|
|
@ -315,7 +315,7 @@ void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order)
|
|||
}
|
||||
}
|
||||
changePersistentIndexList(from, to);
|
||||
|
||||
|
||||
// Recursion
|
||||
for (int i = node->size() - 1; i >= 0; --i) {
|
||||
InnerDecklistNode *subNode = dynamic_cast<InnerDecklistNode *>(node->at(i));
|
||||
|
|
@ -330,7 +330,18 @@ void DeckListModel::sort(int column, Qt::SortOrder order)
|
|||
lastKnownOrder = order;
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
root->setSortMethod(column);
|
||||
DeckSortMethod sortMethod;
|
||||
switch(column) {
|
||||
case 0:
|
||||
sortMethod = ByNumber;
|
||||
break;
|
||||
case 1:
|
||||
sortMethod = ByName;
|
||||
break;
|
||||
case 2:
|
||||
sortMethod = ByPrice;
|
||||
}
|
||||
root->setSortMethod(sortMethod);
|
||||
sortHelper(root, order);
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue