[DeckDockWidget] Correctly handle auto-expand

This commit is contained in:
RickyRister 2025-12-23 05:29:13 -08:00
parent 1c358f3462
commit 52695755ef
2 changed files with 12 additions and 0 deletions

View file

@ -156,6 +156,9 @@ void DeckEditorDeckDockWidget::createDeckDock()
// Delay the update to avoid race conditions // Delay the update to avoid race conditions
QTimer::singleShot(100, this, &DeckEditorDeckDockWidget::updateBannerCardComboBox); QTimer::singleShot(100, this, &DeckEditorDeckDockWidget::updateBannerCardComboBox);
}); });
connect(deckModel, &DeckListModel::cardAddedAt, this, &DeckEditorDeckDockWidget::recursiveExpand);
connect(deckModel, &DeckListModel::deckReplaced, this, &DeckEditorDeckDockWidget::expandAll);
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DeckEditorDeckDockWidget::setBannerCard); &DeckEditorDeckDockWidget::setBannerCard);
bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible()); bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
@ -559,6 +562,14 @@ void DeckEditorDeckDockWidget::recursiveExpand(const QModelIndex &sourceIndex)
} }
} }
/**
* @brief Fully expands all levels of the deck view
*/
void DeckEditorDeckDockWidget::expandAll()
{
deckView->expandRecursively(deckView->rootIndex());
}
/** /**
* Gets the index of all the currently selected card nodes in the decklist table. * Gets the index of all the currently selected card nodes in the decklist table.
* The list is in reverse order of the visual selection, so that rows can be deleted while iterating over them. * The list is in reverse order of the visual selection, so that rows can be deleted while iterating over them.

View file

@ -123,6 +123,7 @@ private slots:
void updateShowTagsWidget(bool visible); void updateShowTagsWidget(bool visible);
void syncBannerCardComboBoxSelectionWithDeck(); void syncBannerCardComboBoxSelectionWithDeck();
void recursiveExpand(const QModelIndex &parent); void recursiveExpand(const QModelIndex &parent);
void expandAll();
}; };
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H #endif // DECK_EDITOR_DECK_DOCK_WIDGET_H