update recursiveExpand

This commit is contained in:
RickyRister 2025-12-23 04:30:14 -08:00
parent ac30d10cb1
commit 18aca5d047
2 changed files with 12 additions and 5 deletions

View file

@ -545,12 +545,19 @@ void DeckEditorDeckDockWidget::cleanDeck()
deckTagsDisplayWidget->setTags(deckModel->getDeckList()->getTags()); deckTagsDisplayWidget->setTags(deckModel->getDeckList()->getTags());
} }
void DeckEditorDeckDockWidget::recursiveExpand(const QModelIndex &index) /**
* @brief Expands all parents of the given index.
* @param sourceIndex The index to expand (model source index)
*/
void DeckEditorDeckDockWidget::recursiveExpand(const QModelIndex &sourceIndex)
{ {
if (index.parent().isValid()) auto index = proxy->mapFromSource(sourceIndex);
recursiveExpand(index.parent());
while (index.parent().isValid()) {
index = index.parent();
deckView->expand(index); deckView->expand(index);
} }
}
/** /**
* 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.

View file

@ -105,7 +105,6 @@ private:
QAction *aRemoveCard, *aIncrement, *aDecrement, *aSwapCard; QAction *aRemoveCard, *aIncrement, *aDecrement, *aSwapCard;
void recursiveExpand(const QModelIndex &index);
[[nodiscard]] QModelIndexList getSelectedCardNodes() const; [[nodiscard]] QModelIndexList getSelectedCardNodes() const;
void offsetCountAtIndex(const QModelIndex &idx, int offset); void offsetCountAtIndex(const QModelIndex &idx, int offset);
@ -123,6 +122,7 @@ private slots:
void updateShowBannerCardComboBox(bool visible); void updateShowBannerCardComboBox(bool visible);
void updateShowTagsWidget(bool visible); void updateShowTagsWidget(bool visible);
void syncBannerCardComboBoxSelectionWithDeck(); void syncBannerCardComboBoxSelectionWithDeck();
void recursiveExpand(const QModelIndex &sourceIndex);
}; };
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H #endif // DECK_EDITOR_DECK_DOCK_WIDGET_H