添加LayerWrapper接口

dev-yyq
karlis 2023-03-19 15:48:42 +08:00
parent 3904ff0b61
commit 8bf6835c23
2 changed files with 18 additions and 0 deletions

View File

@ -414,3 +414,18 @@ bool FolderLayerWrapper::deleteable(bool excludeSubTree) const
else else
return this->referencedCount() == 0; return this->referencedCount() == 0;
} }
bool LayerWrapper::referencingGroupElement() const
{
return false;
}
bool LeafLayerWrapper::referencingGroupElement() const
{
return typeid(*wrappedElement) == typeid(GroupElement);
}
bool LayerWrapper::canApplyStyles() const
{
return typeid(*this) == typeid(LeafLayerWrapper) && !referencingGroupElement();
}

View File

@ -73,6 +73,8 @@ class LayerWrapper
virtual void refreshTreeItem(); virtual void refreshTreeItem();
virtual size_t referencedCount(bool excludeSelf = false) const; virtual size_t referencedCount(bool excludeSelf = false) const;
virtual bool deleteable(bool excludeSubTree = false) const; virtual bool deleteable(bool excludeSubTree = false) const;
virtual bool referencingGroupElement() const;
bool canApplyStyles() const;
}; };
class FolderLayerWrapper : public LayerWrapper class FolderLayerWrapper : public LayerWrapper
@ -117,6 +119,7 @@ class LeafLayerWrapper : public LayerWrapper
void collectDownReachable(std::set<LayerWrapper*>& reachable) override; void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
QTreeWidgetItem* getQTreeItem() override; QTreeWidgetItem* getQTreeItem() override;
void refreshTreeItem() override; void refreshTreeItem() override;
bool referencingGroupElement() const override;
}; };
Q_DECLARE_METATYPE(LayerWrapper *) Q_DECLARE_METATYPE(LayerWrapper *)