mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 15:49:28 -08:00
Set DeckList parent when ownership changes (#6317)
* Initialize all deck list member variables in constructor.
Took 10 minutes
* Revert "Initialize all deck list member variables in constructor."
This reverts commit fba2455808.
* setParent
Took 1 hour 2 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -33,6 +33,7 @@ DeckLoader::DeckLoader(QObject *parent)
|
||||
DeckLoader::DeckLoader(QObject *parent, DeckList *_deckList)
|
||||
: QObject(parent), deckList(_deckList), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||
{
|
||||
deckList->setParent(this);
|
||||
}
|
||||
|
||||
DeckLoader::DeckLoader(const DeckLoader &other)
|
||||
@@ -44,6 +45,7 @@ DeckLoader::DeckLoader(const DeckLoader &other)
|
||||
void DeckLoader::setDeckList(DeckList *_deckList)
|
||||
{
|
||||
deckList = _deckList;
|
||||
deckList->setParent(this);
|
||||
}
|
||||
|
||||
bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest)
|
||||
|
||||
@@ -375,6 +375,7 @@ void DeckEditorDeckDockWidget::syncBannerCardComboBoxSelectionWithDeck()
|
||||
void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
||||
{
|
||||
deckLoader = _deck;
|
||||
deckLoader->setParent(this);
|
||||
deckModel->setDeckList(deckLoader->getDeckList());
|
||||
connect(deckLoader, &DeckLoader::deckLoaded, deckModel, &DeckListModel::rebuildTree);
|
||||
connect(deckLoader->getDeckList(), &DeckList::deckHashChanged, deckModel, &DeckListModel::deckHashChanged);
|
||||
|
||||
Reference in New Issue
Block a user