From 3dab09535666b272d3feb03287f872e2ef2e116d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Tue, 24 Dec 2024 12:33:18 +0100 Subject: [PATCH] Fix unload deck not working by showing/hiding widgets instead of adding/removing to layout. --- cockatrice/src/client/tabs/tab_game.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/client/tabs/tab_game.cpp b/cockatrice/src/client/tabs/tab_game.cpp index 1104cd581..043112173 100644 --- a/cockatrice/src/client/tabs/tab_game.cpp +++ b/cockatrice/src/client/tabs/tab_game.cpp @@ -141,6 +141,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) deckView = new DeckView; connect(deckView, SIGNAL(newCardAdded(AbstractCardItem *)), this, SIGNAL(newCardAdded(AbstractCardItem *))); connect(deckView, SIGNAL(sideboardPlanChanged()), this, SLOT(sideboardPlanChanged())); + deckView->setVisible(false); visualDeckStorageWidget = new VisualDeckStorageWidget(this); connect(visualDeckStorageWidget, &VisualDeckStorageWidget::imageDoubleClicked, this, @@ -148,6 +149,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) deckViewLayout = new QVBoxLayout; deckViewLayout->addLayout(buttonHBox); + deckViewLayout->addWidget(deckView); deckViewLayout->addWidget(visualDeckStorageWidget); deckViewLayout->setContentsMargins(0, 0, 0, 0); setLayout(deckViewLayout); @@ -320,15 +322,17 @@ void DeckViewContainer::replaceDeckStorageWithDeckView(QMouseEvent *event, DeckP connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deckSelectFinished(const Response &))); parentGame->sendGameCommand(pend, playerId); - deckViewLayout->removeWidget(visualDeckStorageWidget); - deckViewLayout->addWidget(deckView); + visualDeckStorageWidget->setVisible(false); + deckView->setVisible(true); + deckViewLayout->update(); unloadDeckButton->setEnabled(true); } void DeckViewContainer::unloadDeck() { - deckViewLayout->removeWidget(deckView); - deckViewLayout->addWidget(visualDeckStorageWidget); + deckView->setVisible(false); + visualDeckStorageWidget->setVisible(true); + deckViewLayout->update(); unloadDeckButton->setEnabled(false); }