Compare commits

...

4 Commits

9 changed files with 39 additions and 13 deletions

View File

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

View File

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

View File

@ -1,5 +1,6 @@
#include "LayerStyleDialog.h"
#include <QComboBox>
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QDebug>
@ -19,8 +20,9 @@ LayerStyleDialog::LayerStyleDialog(
{
this->layerStyle = existedStyle;
QWidget* styleWidget = layerStyle->getInputWidget();
styleWidget->setParent(this);
this->styleContainer = nullptr;
this->styleWidget = layerStyle->getInputWidget();
this->styleWidget->setParent(this);
dialogLayout->addWidget(styleWidget);
// do something
}
@ -59,6 +61,10 @@ LayerStyleDialog::LayerStyleDialog(
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)

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>();
@ -73,3 +82,12 @@ QWidget* FillElementLayerStyle::getListDisplayWidget() const
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;
};

View File

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

View File

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

View File

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