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,11 +545,18 @@ void DeckEditorDeckDockWidget::cleanDeck()
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())
recursiveExpand(index.parent());
deckView->expand(index);
auto index = proxy->mapFromSource(sourceIndex);
while (index.parent().isValid()) {
index = index.parent();
deckView->expand(index);
}
}
/**

View file

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