Signal view removal, addition.

Took 5 minutes
This commit is contained in:
Lukas Brübach 2025-09-10 03:15:20 +02:00
parent aaf3c1e3b2
commit d4a5bb3a79
4 changed files with 19 additions and 5 deletions

View file

@ -149,11 +149,11 @@ void ZoneViewZoneLogic::removeCard(int position, bool toNewZone)
void ZoneViewZoneLogic::setWriteableRevealZone(bool _writeableRevealZone)
{
// TODO: Deal with this
/*if (writeableRevealZone && !_writeableRevealZone) {
origZone->getViews().append(this);
if (writeableRevealZone && !_writeableRevealZone) {
emit addToViews();
} else if (!writeableRevealZone && _writeableRevealZone) {
origZone->getViews().removeOne(this);
}*/
emit removeFromViews();
}
writeableRevealZone = _writeableRevealZone;
}

View file

@ -6,6 +6,8 @@ class ZoneViewZoneLogic : public CardZoneLogic
{
Q_OBJECT
signals:
void addToViews();
void removeFromViews();
void closeView();
private:

View file

@ -34,6 +34,16 @@ ZoneViewZone::ZoneViewZone(ZoneViewZoneLogic *_logic, QGraphicsItem *parent)
connect(_logic, &ZoneViewZoneLogic::closeView, this, &ZoneViewZone::close);
}
void ZoneViewZone::addToViews()
{
qobject_cast<ZoneViewZoneLogic *>(getLogic())->getOriginalZone()->getViews().append(this);
}
void ZoneViewZone::removeFromViews()
{
qobject_cast<ZoneViewZoneLogic *>(getLogic())->getOriginalZone()->getViews().removeOne(this);
}
/**
* Deletes this ZoneView and removes it from the origZone's views.
* You should normally call this method instead of deleteLater()

View file

@ -62,6 +62,8 @@ public:
return optimumRect;
}
public slots:
void addToViews();
void removeFromViews();
void close();
void setFilterString(const QString &_filterString);
void setGroupBy(CardList::SortOption _groupBy);