Move to value based stacks.

Took 52 seconds
This commit is contained in:
Lukas Brübach 2025-11-20 12:00:42 +01:00
parent d4afa0e330
commit 7540fd6632
6 changed files with 28 additions and 31 deletions

View file

@ -73,7 +73,7 @@ void DeckListHistoryManagerWidget::refreshList()
// Fill redo section first (oldest redo at top, newest redo closest to divider)
const auto redoStack = historyManager->getRedoStack();
for (int i = 0; i < redoStack.size(); ++i) { // iterate forward
auto item = new QListWidgetItem(tr("[redo] ") + redoStack[i]->getReason(), historyList);
auto item = new QListWidgetItem(tr("[redo] ") + redoStack[i].getReason(), historyList);
item->setData(Qt::UserRole, QVariant("redo"));
item->setData(Qt::UserRole + 1, i); // index in redo stack
item->setForeground(Qt::gray);
@ -90,7 +90,7 @@ void DeckListHistoryManagerWidget::refreshList()
// Fill undo section
const auto undoStack = historyManager->getUndoStack();
for (int i = undoStack.size() - 1; i >= 0; --i) {
auto item = new QListWidgetItem(tr("[undo] ") + undoStack[i]->getReason(), historyList);
auto item = new QListWidgetItem(tr("[undo] ") + undoStack[i].getReason(), historyList);
item->setData(Qt::UserRole, QVariant("undo"));
item->setData(Qt::UserRole + 1, i); // index in undo stack
historyList->addItem(item);