mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
[DeckDockWidget] Correctly handle auto-expand
This commit is contained in:
parent
1c358f3462
commit
52695755ef
2 changed files with 12 additions and 0 deletions
|
|
@ -156,6 +156,9 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
// Delay the update to avoid race conditions
|
||||
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,
|
||||
&DeckEditorDeckDockWidget::setBannerCard);
|
||||
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.
|
||||
* The list is in reverse order of the visual selection, so that rows can be deleted while iterating over them.
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ private slots:
|
|||
void updateShowTagsWidget(bool visible);
|
||||
void syncBannerCardComboBoxSelectionWithDeck();
|
||||
void recursiveExpand(const QModelIndex &parent);
|
||||
void expandAll();
|
||||
};
|
||||
|
||||
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue