mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Fix command zone tax counter position after counter re-sync
This commit is contained in:
parent
aed13a242d
commit
d42b7c8003
3 changed files with 19 additions and 0 deletions
|
|
@ -242,6 +242,9 @@ void PlayerGraphicsItem::onCounterRemoved(int counterId)
|
||||||
if (playerMenu->getCountersMenu() && widget->getMenu()) {
|
if (playerMenu->getCountersMenu() && widget->getMenu()) {
|
||||||
playerMenu->getCountersMenu()->removeAction(widget->getMenu()->menuAction());
|
playerMenu->getCountersMenu()->removeAction(widget->getMenu()->menuAction());
|
||||||
}
|
}
|
||||||
|
if (commandZoneGraphicsItem && CounterNames::isTaxCounter(widget->getName())) {
|
||||||
|
commandZoneGraphicsItem->unregisterTaxCounter(widget);
|
||||||
|
}
|
||||||
widget->delCounter();
|
widget->delCounter();
|
||||||
rearrangeCounters();
|
rearrangeCounters();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,15 @@ void CommandZone::registerTaxCounter(AbstractCounter *counter)
|
||||||
connect(counter, &QObject::destroyed, this, [this, counter]() { taxCounters.removeOne(counter); });
|
connect(counter, &QObject::destroyed, this, [this, counter]() { taxCounters.removeOne(counter); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandZone::unregisterTaxCounter(AbstractCounter *counter)
|
||||||
|
{
|
||||||
|
if (!counter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
disconnect(counter, &QObject::destroyed, this, nullptr);
|
||||||
|
taxCounters.removeOne(counter);
|
||||||
|
}
|
||||||
|
|
||||||
void CommandZone::rearrangeTaxCounters()
|
void CommandZone::rearrangeTaxCounters()
|
||||||
{
|
{
|
||||||
int activeTaxCounterCount = 0;
|
int activeTaxCounterCount = 0;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,13 @@ public:
|
||||||
void setMinimumHeight(int height);
|
void setMinimumHeight(int height);
|
||||||
/** @brief Registers a tax counter widget for layout management. */
|
/** @brief Registers a tax counter widget for layout management. */
|
||||||
void registerTaxCounter(AbstractCounter *counter);
|
void registerTaxCounter(AbstractCounter *counter);
|
||||||
|
/**
|
||||||
|
* @brief Unregisters a tax counter widget from layout management.
|
||||||
|
*
|
||||||
|
* Call on removal: the widget outlives it via deleteLater(), so unregister synchronously
|
||||||
|
* to keep it out of the next layout pass.
|
||||||
|
*/
|
||||||
|
void unregisterTaxCounter(AbstractCounter *counter);
|
||||||
/** @brief Lays out visible tax counters vertically in the top-left corner of the command zone. */
|
/** @brief Lays out visible tax counters vertically in the top-left corner of the command zone. */
|
||||||
void rearrangeTaxCounters();
|
void rearrangeTaxCounters();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue