From 8bf6835c234cced8f7efe0401685d66efef3915b Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Sun, 19 Mar 2023 15:48:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0LayerWrapper=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/LayerWrapper.cpp | 15 +++++++++++++++ .../src/Editor/LayerWrapper.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp index 770c45d..bf0222b 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp @@ -413,4 +413,19 @@ bool FolderLayerWrapper::deleteable(bool excludeSubTree) const return this->getReferencedBy() == -1; else 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(); } \ No newline at end of file diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h index b62d685..947d90c 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h @@ -73,6 +73,8 @@ class LayerWrapper virtual void refreshTreeItem(); virtual size_t referencedCount(bool excludeSelf = false) const; virtual bool deleteable(bool excludeSubTree = false) const; + virtual bool referencingGroupElement() const; + bool canApplyStyles() const; }; class FolderLayerWrapper : public LayerWrapper @@ -117,6 +119,7 @@ class LeafLayerWrapper : public LayerWrapper void collectDownReachable(std::set& reachable) override; QTreeWidgetItem* getQTreeItem() override; void refreshTreeItem() override; + bool referencingGroupElement() const override; }; Q_DECLARE_METATYPE(LayerWrapper *)