allow multiple zoneviews (#4263)

This commit is contained in:
ebbit1q 2021-03-13 20:43:50 +01:00 committed by GitHub
parent 1811f7305e
commit 8e1d7d12e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 32 deletions

View file

@ -26,16 +26,18 @@ ZoneViewZone::ZoneViewZone(Player *_p,
numberCards(_numberCards), origZone(_origZone), revealZone(_revealZone),
writeableRevealZone(_writeableRevealZone), sortByName(false), sortByType(false)
{
if (!(revealZone && !writeableRevealZone))
origZone->setView(this);
if (!(revealZone && !writeableRevealZone)) {
origZone->getViews().append(this);
}
}
ZoneViewZone::~ZoneViewZone()
{
emit beingDeleted();
qDebug("ZoneViewZone destructor");
if (!(revealZone && !writeableRevealZone))
origZone->setView(NULL);
if (!(revealZone && !writeableRevealZone)) {
origZone->getViews().removeOne(this);
}
}
QRectF ZoneViewZone::boundingRect() const
@ -238,11 +240,11 @@ QSizeF ZoneViewZone::sizeHint(Qt::SizeHint /*which*/, const QSizeF & /*constrain
void ZoneViewZone::setWriteableRevealZone(bool _writeableRevealZone)
{
if (writeableRevealZone && !_writeableRevealZone)
origZone->setView(this);
else if (!writeableRevealZone && _writeableRevealZone)
origZone->setView(NULL);
if (writeableRevealZone && !_writeableRevealZone) {
origZone->getViews().append(this);
} else if (!writeableRevealZone && _writeableRevealZone) {
origZone->getViews().removeOne(this);
}
writeableRevealZone = _writeableRevealZone;
}