Compare commits

..

4 Commits

9 changed files with 39 additions and 13 deletions

View File

@ -105,7 +105,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp" /> <ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp" />
<ClCompile Include="src\Editor\LayerStyleDialog.cpp" /> <ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp" />
<ClCompile Include="src\Editor\EditorWidget.cpp" /> <ClCompile Include="src\Editor\EditorWidget.cpp" />
<ClCompile Include="src\Editor\EditorWidgetItem.cpp" /> <ClCompile Include="src\Editor\EditorWidgetItem.cpp" />
<ClCompile Include="src\Editor\ElementManager.cpp" /> <ClCompile Include="src\Editor\ElementManager.cpp" />
@ -192,7 +192,7 @@
<QtMoc Include="src\MainWindow.h" /> <QtMoc Include="src\MainWindow.h" />
<QtMoc Include="src\Editor\EditorWidget.h" /> <QtMoc Include="src\Editor\EditorWidget.h" />
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" /> <QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" />
<QtMoc Include="src\Editor\LayerStyleDialog.h" /> <QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h" />
<ClInclude Include="src\Editor\ElementManager.h" /> <ClInclude Include="src\Editor\ElementManager.h" />
<QtMoc Include="src\Editor\ElementPoolWidget.h" /> <QtMoc Include="src\Editor\ElementPoolWidget.h" />
<ClInclude Include="src\Editor\GraphicElement.h" /> <ClInclude Include="src\Editor\GraphicElement.h" />

View File

@ -219,7 +219,7 @@
<ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp"> <ClCompile Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Editor\LayerStyleDialog.cpp"> <ClCompile Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@ -260,7 +260,7 @@
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h"> <QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="src\Editor\LayerStyleDialog.h"> <QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
</ItemGroup> </ItemGroup>

View File

@ -1,5 +1,6 @@
#include "LayerStyleDialog.h" #include "LayerStyleDialog.h"
#include <QComboBox> #include <QComboBox>
#include <QDialogButtonBox>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QDebug> #include <QDebug>
@ -19,8 +20,9 @@ LayerStyleDialog::LayerStyleDialog(
{ {
this->layerStyle = existedStyle; this->layerStyle = existedStyle;
QWidget* styleWidget = layerStyle->getInputWidget(); this->styleContainer = nullptr;
styleWidget->setParent(this); this->styleWidget = layerStyle->getInputWidget();
this->styleWidget->setParent(this);
dialogLayout->addWidget(styleWidget); dialogLayout->addWidget(styleWidget);
// do something // do something
} }
@ -59,6 +61,10 @@ LayerStyleDialog::LayerStyleDialog(
this, &LayerStyleDialog::onStyleTypeSelectorChanged); this, &LayerStyleDialog::onStyleTypeSelectorChanged);
} }
} }
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &LayerStyleDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &LayerStyleDialog::reject);
dialogLayout->addWidget(buttonBox);
} }
void LayerStyleDialog::onStyleTypeSelectorChanged(int index) void LayerStyleDialog::onStyleTypeSelectorChanged(int index)

View File

@ -45,6 +45,15 @@ QWidget* StrokeElementLayerStyle::getListDisplayWidget() const
return w; 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 std::vector<Renderer::BaseStyle> FillElementLayerStyle::toBaseStyles() const
{ {
return std::vector<Renderer::BaseStyle>(); return std::vector<Renderer::BaseStyle>();
@ -72,4 +81,13 @@ QWidget* FillElementLayerStyle::getListDisplayWidget() const
layout->setMargin(0); layout->setMargin(0);
layout->addWidget(name); layout->addWidget(name);
return w; 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* getInputWidget() const override;
QWidget* getListDisplayWidget() const override; QWidget* getListDisplayWidget() const override;
StrokeElementLayerStyle() = default; StrokeElementLayerStyle() = default;
StrokeElementLayerStyle(StrokeElementLayerStyle& other);
~StrokeElementLayerStyle() = default; ~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 class FillElementLayerStyle : public Renderer::ElementStyle, public LayerStyle
@ -46,6 +47,7 @@ public:
QWidget* getInputWidget() const override; QWidget* getInputWidget() const override;
QWidget* getListDisplayWidget() const override; QWidget* getListDisplayWidget() const override;
FillElementLayerStyle() = default; FillElementLayerStyle() = default;
FillElementLayerStyle(FillElementLayerStyle& other);
~FillElementLayerStyle() = default; ~FillElementLayerStyle() = default;
std::vector<std::shared_ptr<Renderer::MaterialFill>> materialStyles; std::vector<std::shared_ptr<Renderer::MaterialStyleFill>> materialStyles;
}; };

View File

@ -1,5 +1,5 @@
#include "InfoDisplayWidget.h" #include "InfoDisplayWidget.h"
#include "LayerStyleDialog.h" #include "./EditorWidgetComponent/LayerStyleDialog.h"
#include <QLineEdit> #include <QLineEdit>
#include <QTextBlock> #include <QTextBlock>
#include <QListWidget> #include <QListWidget>
@ -191,7 +191,7 @@ void InfoDisplayWidget::generateLayerForm()
removeButton->setFixedSize(QSize(20, 20)); removeButton->setFixedSize(QSize(20, 20));
connect(detailButton, &QPushButton::clicked, this, connect(detailButton, &QPushButton::clicked, this,
[=]() [this, styleIterator]()
{ {
LayerStyleDialog* dialog = new LayerStyleDialog(nullptr, *styleIterator); LayerStyleDialog* dialog = new LayerStyleDialog(nullptr, *styleIterator);
dialog->exec(); dialog->exec();

View File

@ -33,7 +33,7 @@ namespace Renderer
virtual MaterialStyleType type() const override; virtual MaterialStyleType type() const override;
virtual std::vector<GLfloat> encoded() const override; virtual std::vector<GLfloat> encoded() const override;
virtual bool operator==(const MaterialStyle&) const override; virtual bool operator==(const MaterialStyle&) const override;
protected: //protected:
std::shared_ptr<MaterialFill> materialFill; std::shared_ptr<MaterialFill> materialFill;
}; };

View File

@ -50,7 +50,7 @@ namespace Renderer
virtual std::vector<GLfloat> encoded() const override; virtual std::vector<GLfloat> encoded() const override;
virtual bool operator==(const MaterialStyle&) const override; virtual bool operator==(const MaterialStyle&) const override;
float getHalfWidth() const; float getHalfWidth() const;
protected: //protected:
float halfWidth; float halfWidth;
StrokeType strokeType; StrokeType strokeType;
StrokeEndType endType; StrokeEndType endType;