mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
add "Set Banner Card" action to VDS right-click menu (#5692)
This commit is contained in:
parent
6bb9ae92bf
commit
ff7f31ca33
2 changed files with 25 additions and 0 deletions
|
|
@ -288,6 +288,8 @@ QMenu *DeckPreviewWidget::createRightClickMenu()
|
|||
connect(menu->addAction(tr("Edit Tags")), &QAction::triggered, deckTagsDisplayWidget,
|
||||
&DeckPreviewDeckTagsDisplayWidget::openTagEditDlg);
|
||||
|
||||
addSetBannerCardMenu(menu);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
connect(menu->addAction(tr("Rename Deck")), &QAction::triggered, this, &DeckPreviewWidget::actRenameDeck);
|
||||
|
|
@ -312,6 +314,28 @@ QMenu *DeckPreviewWidget::createRightClickMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the "Set Banner Card" submenu to the given menu. Does nothing if bannerCardComboBox is null.
|
||||
* @param menu The menu to add the submenu to
|
||||
*/
|
||||
void DeckPreviewWidget::addSetBannerCardMenu(QMenu *menu)
|
||||
{
|
||||
if (!bannerCardComboBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto bannerCardMenu = menu->addMenu(tr("Set Banner Card"));
|
||||
|
||||
for (int i = 0; i < bannerCardComboBox->count(); ++i) {
|
||||
auto action = bannerCardMenu->addAction(bannerCardComboBox->itemText(i));
|
||||
connect(action, &QAction::triggered, this, [this, i] { bannerCardComboBox->setCurrentIndex(i); });
|
||||
|
||||
// the checkability is purely for visuals
|
||||
action->setCheckable(true);
|
||||
action->setChecked(bannerCardComboBox->currentIndex() == i);
|
||||
}
|
||||
}
|
||||
|
||||
void DeckPreviewWidget::actRenameDeck()
|
||||
{
|
||||
// read input
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public slots:
|
|||
|
||||
private:
|
||||
QMenu *createRightClickMenu();
|
||||
void addSetBannerCardMenu(QMenu *menu);
|
||||
|
||||
private slots:
|
||||
void actRenameDeck();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue