From 0ff779c5b285b13127a55efafee8a550559bfbaf Mon Sep 17 00:00:00 2001 From: ArgonarioD Date: Tue, 14 Mar 2023 22:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E7=A8=B3=E5=AE=9A=E4=BA=86st?= =?UTF-8?q?rokeStyle=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/LayerStyle.cpp | 38 ++----------------- .../src/Editor/LayerStyle.h | 1 + 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp index 4d88518..e44e855 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp @@ -23,11 +23,6 @@ const std::vector() std::vector StrokeElementLayerStyle::toBaseStyles() const { std::vector baseStyles; - /*for (auto materialStyle : materialStyles) - { - baseStyles.push_back(Renderer::BaseStyle(std::make_shared(), - materialStyle)); - }*/ if (enableEachSideIndependent) { baseStyles.push_back(Renderer::BaseStyle(std::make_shared(), @@ -37,10 +32,10 @@ std::vector StrokeElementLayerStyle::toBaseStyles() const } else { - strokePair.first->strokeType = Renderer::StrokeType::kBothSides; - baseStyles.push_back(Renderer::BaseStyle(std::make_shared(), - strokePair.first)); - strokePair.first->strokeType = Renderer::StrokeType::kLeftSide; + auto material = std::shared_ptr(std::move(strokePair.first->clone())); + std::dynamic_pointer_cast(material)->strokeType = Renderer::StrokeType::kBothSides; + + baseStyles.push_back(Renderer::BaseStyle(std::make_shared(), material)); } return baseStyles; } @@ -104,31 +99,6 @@ QWidget* StrokeElementLayerStyle::getInputWidget() this->enableEachSideIndependent = toggled; rightStrokeView->setDisabled(!toggled); }); - //auto stroke = std::dynamic_pointer_cast(this->materialStyles[0]->materialStroke); - //QColor* color = &(stroke->materialMap[1.0].color); - /*auto stroke = std::dynamic_pointer_cast(this->materialStyles[0]->materialStroke); - QColor* color = &(stroke->material.color); - r->setText(QString::number(color->red())); - g->setText(QString::number(color->green())); - b->setText(QString::number(color->blue())); - QObject::connect(r, &QLineEdit::textChanged, [color](QString content) { - if (!content.isEmpty()) - { - color->setRed(content.toInt()); - } - }); - QObject::connect(g, &QLineEdit::textChanged, [color](QString content) { - if (!content.isEmpty()) - { - color->setGreen(content.toInt()); - } - }); - QObject::connect(b, &QLineEdit::textChanged, [color](QString content) { - if (!content.isEmpty()) - { - color->setBlue(content.toInt()); - } - });*/ return w; } diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.h b/ArchitectureColoredPainting/src/Editor/LayerStyle.h index 3012ebe..7d5fb25 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.h +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.h @@ -9,6 +9,7 @@ #include "../Renderer/Painting/MaterialStyleStroke.h" #include "../Renderer/Painting/MaterialStyleFill.h" +using Renderer::MaterialStyle; using Renderer::MaterialStyleStroke; /**