From aa9743d4e735367b22c2793428a6c0cf50a77ba5 Mon Sep 17 00:00:00 2001 From: karlis <2995621482@qq.com> Date: Thu, 23 Mar 2023 15:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=9B=E5=BB=BALeafLayer?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=BB=84=E5=90=88=E5=85=83=E7=B4=A0=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E6=9E=90=E6=9E=84=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/RightBar/LayerTreeWidget.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ArchitectureColoredPainting/src/Editor/RightBar/LayerTreeWidget.cpp b/ArchitectureColoredPainting/src/Editor/RightBar/LayerTreeWidget.cpp index 721594c..cc1b052 100644 --- a/ArchitectureColoredPainting/src/Editor/RightBar/LayerTreeWidget.cpp +++ b/ArchitectureColoredPainting/src/Editor/RightBar/LayerTreeWidget.cpp @@ -59,14 +59,19 @@ void LayerTreeWidget::popMenu(const QPoint &pos) auto dialog = new LayerCreateWidget(elementManager, dynamic_cast(layer), this); connect(dialog, &LayerCreateWidget::LayerInfoReturned, this, [this, layer](QJsonObject jsonObj) { auto folderLayer = dynamic_cast(layer); - LayerWrapper* newLayer; + std::shared_ptr newLayer; qDebug() << this->elementManager; - if(jsonObj.value("is-folder").toBool()) - newLayer = new FolderLayerWrapper(jsonObj, this->elementManager, folderLayer); + if (jsonObj.value("is-folder").toBool()) + { + newLayer = std::make_shared(jsonObj, this->elementManager, folderLayer); + folderLayer->addChild(newLayer); + } else - newLayer = new LeafLayerWrapper(jsonObj, this->elementManager, folderLayer); + { + newLayer = std::make_shared(jsonObj, this->elementManager, folderLayer); + folderLayer->addChild(newLayer); + } - folderLayer->addChild(std::shared_ptr(newLayer)); folderLayer->qTreeWidgetItem->addChild(newLayer->getQTreeItem()); qDebug() << jsonObj<<"----------------------"; emit triggerCentralRefresh();