Correctly reset banner card if none was set but card appears in new deck. (#6107)

This commit is contained in:
BruebachL
2025-09-07 06:26:07 +02:00
committed by GitHub
parent 6e0a7de9cc
commit 9c18e99fe2
2 changed files with 17 additions and 1 deletions

View File

@@ -346,6 +346,20 @@ void DeckEditorDeckDockWidget::updateShowTagsWidget(const bool visible)
deckTagsDisplayWidget->setHidden(!visible);
}
void DeckEditorDeckDockWidget::syncBannerCardComboBoxSelectionWithDeck()
{
if (deckModel->getDeckList()->getBannerCard().name == "") {
if (bannerCardComboBox->findText("-") != -1) {
bannerCardComboBox->setCurrentIndex(bannerCardComboBox->findText("-"));
} else {
bannerCardComboBox->insertItem(0, "-");
bannerCardComboBox->setCurrentIndex(0);
}
} else {
bannerCardComboBox->setCurrentText(deckModel->getDeckList()->getBannerCard().name);
}
}
/**
* Sets the currently active deck for this tab
* @param _deck The deck. Takes ownership of the object
@@ -356,7 +370,8 @@ void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
nameEdit->setText(deckModel->getDeckList()->getName());
commentsEdit->setText(deckModel->getDeckList()->getComments());
bannerCardComboBox->setCurrentText(deckModel->getDeckList()->getBannerCard().name);
syncBannerCardComboBoxSelectionWithDeck();
updateBannerCardComboBox();
updateHash();
deckModel->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());

View File

@@ -88,6 +88,7 @@ private slots:
void refreshShortcuts();
void updateShowBannerCardComboBox(bool visible);
void updateShowTagsWidget(bool visible);
void syncBannerCardComboBoxSelectionWithDeck();
};
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H