mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-24 02:13:02 -07:00
[DeckEditor] Reuse the inherited CardDatabaseModel in the visual editor (#7112)
Took 6 minutes Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
813a3ea034
commit
2eca362e2b
4 changed files with 13 additions and 9 deletions
|
|
@ -29,8 +29,10 @@
|
|||
|
||||
VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
|
||||
DeckListModel *_deckListModel,
|
||||
QItemSelectionModel *_selectionModel)
|
||||
: QWidget(parent), deckListModel(_deckListModel), selectionModel(_selectionModel)
|
||||
QItemSelectionModel *_selectionModel,
|
||||
CardDatabaseModel *_cardDatabaseModel)
|
||||
: QWidget(parent), deckListModel(_deckListModel), selectionModel(_selectionModel),
|
||||
cardDatabaseModel(_cardDatabaseModel)
|
||||
{
|
||||
// The Main Widget and Main Layout, which contain a single Widget: The Scroll Area
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
|
@ -94,7 +96,9 @@ void VisualDeckEditorWidget::initializeSearchBarAndCompleter()
|
|||
setFocusProxy(searchBar);
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
cardDatabaseModel = new CardDatabaseModel(CardDatabaseManager::getInstance(), false, this);
|
||||
if (!cardDatabaseModel) {
|
||||
cardDatabaseModel = new CardDatabaseModel(CardDatabaseManager::getInstance(), false, this);
|
||||
}
|
||||
cardDatabaseDisplayModel = new CardDatabaseDisplayModel(this);
|
||||
cardDatabaseDisplayModel->setSourceModel(cardDatabaseModel);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ class VisualDeckEditorWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VisualDeckEditorWidget(QWidget *parent, DeckListModel *deckListModel, QItemSelectionModel *selectionModel);
|
||||
explicit VisualDeckEditorWidget(QWidget *parent,
|
||||
DeckListModel *deckListModel,
|
||||
QItemSelectionModel *selectionModel,
|
||||
CardDatabaseModel *_cardDatabaseModel = nullptr);
|
||||
void retranslateUi();
|
||||
void updateCompactMode();
|
||||
void clearAllDisplayWidgets();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue