mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
extract applyActiveGroupCriteria
This commit is contained in:
parent
8967ec6683
commit
2e5d6ccb74
2 changed files with 12 additions and 5 deletions
|
|
@ -64,6 +64,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
connect(deckStateManager, &DeckStateManager::focusIndexChanged, this, &DeckEditorDeckDockWidget::setSelectedIndex);
|
||||
connect(deckStateManager, &DeckStateManager::deckReplaced, this,
|
||||
&DeckEditorDeckDockWidget::syncDisplayWidgetsToModel);
|
||||
connect(deckStateManager, &DeckStateManager::deckReplaced, this,
|
||||
&DeckEditorDeckDockWidget::applyActiveGroupCriteria);
|
||||
|
||||
deckView = new QTreeView();
|
||||
deckView->setObjectName("deckView");
|
||||
|
|
@ -174,11 +176,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
activeGroupCriteriaComboBox->addItem(tr("Main Type"), DeckListModelGroupCriteria::MAIN_TYPE);
|
||||
activeGroupCriteriaComboBox->addItem(tr("Mana Cost"), DeckListModelGroupCriteria::MANA_COST);
|
||||
activeGroupCriteriaComboBox->addItem(tr("Colors"), DeckListModelGroupCriteria::COLOR);
|
||||
connect(activeGroupCriteriaComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() {
|
||||
getModel()->setActiveGroupCriteria(static_cast<DeckListModelGroupCriteria::Type>(
|
||||
activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
||||
getModel()->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
||||
});
|
||||
connect(activeGroupCriteriaComboBox, &QComboBox::currentIndexChanged, this,
|
||||
&DeckEditorDeckDockWidget::applyActiveGroupCriteria);
|
||||
|
||||
aIncrement = new QAction(QString(), this);
|
||||
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
||||
|
|
@ -428,6 +427,13 @@ void DeckEditorDeckDockWidget::writeBannerCard(int index)
|
|||
deckStateManager->setBannerCard(bannerCard);
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::applyActiveGroupCriteria()
|
||||
{
|
||||
getModel()->setActiveGroupCriteria(
|
||||
static_cast<DeckListModelGroupCriteria::Type>(activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
||||
getModel()->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
||||
{
|
||||
bannerCardLabel->setHidden(!visible);
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ private slots:
|
|||
void writeName();
|
||||
void writeComments();
|
||||
void writeBannerCard(int);
|
||||
void applyActiveGroupCriteria();
|
||||
void setSelectedIndex(const QModelIndex &newCardIndex);
|
||||
void updateHash();
|
||||
void refreshShortcuts();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue