mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 07:40:30 -08:00
Sync up Visual Deck Editor group by combo box to Deck Editor Dock Widget combo box. (#6291)
Took 21 minutes Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -41,6 +41,10 @@ public:
|
||||
{
|
||||
return nameEdit->text().simplified();
|
||||
}
|
||||
QComboBox *getGroupByComboBox()
|
||||
{
|
||||
return activeGroupCriteriaComboBox;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void cleanDeck();
|
||||
|
||||
@@ -124,6 +124,11 @@ public:
|
||||
*/
|
||||
void setModified(bool _windowModified);
|
||||
|
||||
DeckEditorDeckDockWidget *getDeckDockWidget() const
|
||||
{
|
||||
return deckDockWidget;
|
||||
}
|
||||
|
||||
// UI Elements
|
||||
DeckEditorMenu *deckMenu; ///< Menu for deck operations
|
||||
DeckEditorDatabaseDisplayWidget *databaseDisplayDockWidget; ///< Database dock
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "../cards/deck_card_zone_display_widget.h"
|
||||
#include "../general/layout_containers/flow_widget.h"
|
||||
#include "../general/layout_containers/overlap_control_widget.h"
|
||||
#include "../tabs/visual_deck_editor/tab_deck_editor_visual.h"
|
||||
#include "../tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QCompleter>
|
||||
@@ -119,13 +121,30 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_
|
||||
groupAndSortLayout->setAlignment(Qt::AlignLeft);
|
||||
groupAndSortContainer->setLayout(groupAndSortLayout);
|
||||
|
||||
groupByComboBox = new QComboBox();
|
||||
QStringList groupProperties = {"maintype", "colors", "cmc", "name"};
|
||||
groupByComboBox->addItems(groupProperties);
|
||||
groupByComboBox->setMinimumWidth(300);
|
||||
connect(groupByComboBox, QOverload<const QString &>::of(&QComboBox::currentTextChanged), this,
|
||||
&VisualDeckEditorWidget::actChangeActiveGroupCriteria);
|
||||
actChangeActiveGroupCriteria();
|
||||
groupByComboBox = new QComboBox(this);
|
||||
if (auto tabWidget = qobject_cast<TabDeckEditorVisualTabWidget *>(parent)) {
|
||||
// Inside a central widget QWidget container inside TabDeckEditorVisual
|
||||
if (auto tab = qobject_cast<TabDeckEditorVisual *>(tabWidget->parent()->parent())) {
|
||||
auto originalBox = tab->getDeckDockWidget()->getGroupByComboBox();
|
||||
groupByComboBox->setModel(originalBox->model());
|
||||
groupByComboBox->setModelColumn(originalBox->modelColumn());
|
||||
|
||||
// Original -> clone
|
||||
connect(originalBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this](int index) { groupByComboBox->setCurrentIndex(index); });
|
||||
|
||||
// Clone -> original
|
||||
connect(groupByComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[originalBox](int index) { originalBox->setCurrentIndex(index); });
|
||||
}
|
||||
} else {
|
||||
QStringList groupProperties = {"maintype", "colors", "cmc", "name"};
|
||||
groupByComboBox->addItems(groupProperties);
|
||||
groupByComboBox->setMinimumWidth(300);
|
||||
connect(groupByComboBox, QOverload<const QString &>::of(&QComboBox::currentTextChanged), this,
|
||||
&VisualDeckEditorWidget::actChangeActiveGroupCriteria);
|
||||
actChangeActiveGroupCriteria();
|
||||
}
|
||||
|
||||
sortCriteriaButton = new SettingsButtonWidget(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user