Correctly reset banner card if none was set but card appears in new deck.

Took 33 minutes
This commit is contained in:
Lukas Brübach 2025-09-07 01:57:27 +02:00
parent 6e0a7de9cc
commit 6c4ec30d87
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