修改了LayerStyle的materialStyles的类型,添加了深拷贝构造函数

TaoZhang-Branch
ArgonarioD 2023-03-10 16:07:07 +08:00
parent 7c7cd02d71
commit 94b16ac536
2 changed files with 23 additions and 3 deletions

View File

@ -45,6 +45,15 @@ QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
return w;
}
StrokeElementLayerStyle::StrokeElementLayerStyle(StrokeElementLayerStyle& other)
{
materialStyles = std::vector<std::shared_ptr<Renderer::MaterialStyleStroke>>(other.materialStyles.size());
for (size_t i = 0; i < other.materialStyles.size(); i++)
{
materialStyles[i] = std::make_shared<Renderer::MaterialStyleStroke>(*other.materialStyles[i]);
}
}
std::vector<Renderer::BaseStyle> FillElementLayerStyle::toBaseStyles() const
{
return std::vector<Renderer::BaseStyle>();
@ -72,4 +81,13 @@ QWidget* FillElementLayerStyle::getListDisplayWidget() const
layout->setMargin(0);
layout->addWidget(name);
return w;
}
}
FillElementLayerStyle::FillElementLayerStyle(FillElementLayerStyle& other)
{
materialStyles = std::vector<std::shared_ptr<Renderer::MaterialStyleFill>>(other.materialStyles.size());
for (size_t i = 0; i < other.materialStyles.size(); i++)
{
materialStyles[i] = std::make_shared<Renderer::MaterialStyleFill>(*other.materialStyles[i]);
}
}

View File

@ -34,8 +34,9 @@ public:
QWidget* getInputWidget() const override;
QWidget* getListDisplayWidget() const override;
StrokeElementLayerStyle() = default;
StrokeElementLayerStyle(StrokeElementLayerStyle& other);
~StrokeElementLayerStyle() = default;
std::vector<std::shared_ptr<Renderer::MaterialStroke>> materialStyles;
std::vector<std::shared_ptr<Renderer::MaterialStyleStroke>> materialStyles;
};
class FillElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
@ -46,6 +47,7 @@ public:
QWidget* getInputWidget() const override;
QWidget* getListDisplayWidget() const override;
FillElementLayerStyle() = default;
FillElementLayerStyle(FillElementLayerStyle& other);
~FillElementLayerStyle() = default;
std::vector<std::shared_ptr<Renderer::MaterialFill>> materialStyles;
std::vector<std::shared_ptr<Renderer::MaterialStyleFill>> materialStyles;
};