[stroke] 对GUI做出了一些改善
parent
096c3ac848
commit
fb7caf407c
|
@ -2,8 +2,8 @@
|
|||
#include "ColorPicker.h"
|
||||
#include <qtmaterialraisedbutton.h>
|
||||
#include <limits>
|
||||
#include <lib/qtmaterialstyle.h>
|
||||
|
||||
#define radialStroke(stroke) std::dynamic_pointer_cast<Renderer::StrokeRadialGradient>(stroke->materialStroke)
|
||||
constexpr int COLUMN_WIDTH = 0;
|
||||
constexpr int COLUMN_COLOR = 1;
|
||||
constexpr int COLUMN_METALLIC = 2;
|
||||
|
@ -38,7 +38,7 @@ StrokeStyleWidget::StrokeStyleWidget(
|
|||
void StrokeStyleWidget::initStrokeSettings()
|
||||
{
|
||||
this->enableGradual = new QtMaterialCheckBox(this);
|
||||
enableGradual->setText(QStringLiteral("启用渐变"));
|
||||
enableGradual->setText(QStringLiteral("½¥±ä"));
|
||||
enableGradual->setChecked(radialStroke(stroke)->gradual);
|
||||
connect(enableGradual, &QtMaterialCheckBox::toggled, [this](bool checked) {
|
||||
radialStroke(this->stroke)->gradual = checked;
|
||||
|
@ -106,8 +106,11 @@ void StrokeStyleWidget::initTable(std::shared_ptr<Renderer::StrokeRadialGradient
|
|||
}
|
||||
// ÐÂÔö°´Å¥
|
||||
QtMaterialRaisedButton* addButton = new QtMaterialRaisedButton("+", strokeTable);
|
||||
addButton->setBackgroundColor(QtMaterialStyle::instance().themeColor("primary1"));
|
||||
strokeTable->setSpan(row, 0, 1, 5);
|
||||
strokeTable->setCellWidget(row, 0, addButton);
|
||||
strokeTable->setMinimumHeight(strokeTable->rowHeight(row) * 5);
|
||||
addButton->setFixedHeight(strokeTable->rowHeight(row));
|
||||
connect(addButton, &QtMaterialRaisedButton::clicked, [this]() {
|
||||
handlingRowInsert = true;
|
||||
auto materialMap = &(radialStroke(this->stroke)->materialMap);
|
||||
|
@ -160,6 +163,7 @@ void StrokeStyleWidget::setTableRow(int row, float width, Renderer::Material& ma
|
|||
strokeTable->setItem(row, COLUMN_ROUGHNESS, roughnessItem);
|
||||
|
||||
QtMaterialRaisedButton* removeButton = new QtMaterialRaisedButton("-", strokeTable);
|
||||
removeButton->setBackgroundColor(QtMaterialStyle::instance().themeColor("primary1"));
|
||||
removeButton->setFixedSize(20, 20);
|
||||
strokeTable->setCellWidget(row, COLUMN_OPERATIONS, removeButton);
|
||||
connect(removeButton, &QtMaterialRaisedButton::clicked, [this, row]() {
|
||||
|
|
|
@ -25,13 +25,19 @@ std::vector<Renderer::BaseStyle> StrokeElementLayerStyle::toBaseStyles() const
|
|||
{
|
||||
std::vector<Renderer::BaseStyle> baseStyles;
|
||||
if (enableEachSideIndependent)
|
||||
{
|
||||
if (radialStroke(strokePair.first)->materialMap.size())
|
||||
{
|
||||
baseStyles.push_back(Renderer::BaseStyle(std::make_shared<Renderer::TransformStyle>(),
|
||||
strokePair.first));
|
||||
}
|
||||
if (radialStroke(strokePair.second)->materialMap.size())
|
||||
{
|
||||
baseStyles.push_back(Renderer::BaseStyle(std::make_shared<Renderer::TransformStyle>(),
|
||||
strokePair.second));
|
||||
}
|
||||
else
|
||||
}
|
||||
else if (radialStroke(strokePair.first)->materialMap.size())
|
||||
{
|
||||
auto material = std::shared_ptr<MaterialStyle>(std::move(strokePair.first->clone()));
|
||||
std::dynamic_pointer_cast<MaterialStyleStroke>(material)->strokeType = Renderer::StrokeType::kBothSides;
|
||||
|
@ -80,7 +86,7 @@ QWidget* StrokeElementLayerStyle::getInputWidget()
|
|||
layout->addWidget(leftStrokeView);
|
||||
|
||||
QtMaterialCheckBox* checkEachSideIndependent = new QtMaterialCheckBox(w);
|
||||
checkEachSideIndependent->setText(QStringLiteral("启用两侧独立描边"));
|
||||
checkEachSideIndependent->setText(QStringLiteral("ÓÒ²à¶ÀÁ¢Ãè±ß"));
|
||||
checkEachSideIndependent->setChecked(enableEachSideIndependent);
|
||||
layout->addWidget(checkEachSideIndependent);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ using Renderer::MaterialStyle;
|
|||
using Renderer::MaterialStyleStroke;
|
||||
|
||||
#define STYLE_TYPENAME(name) static QString getTypeName() { return name; }
|
||||
#define radialStroke(stroke) std::dynamic_pointer_cast<Renderer::StrokeRadialGradient>(stroke->materialStroke)
|
||||
|
||||
/**
|
||||
* 在进行Style的添加时,首先创建空对象,然后直接调用getInputWidget()方法
|
||||
|
@ -39,8 +40,6 @@ public:
|
|||
class StrokeElementLayerStyle : public LayerStyle
|
||||
{
|
||||
using PMaterialStyleStroke = std::shared_ptr<MaterialStyleStroke>;
|
||||
private:
|
||||
std::pair<PMaterialStyleStroke, PMaterialStyleStroke> strokePair;
|
||||
|
||||
public:
|
||||
STYLE_TYPENAME("stroke")
|
||||
|
@ -56,6 +55,7 @@ public:
|
|||
QWidget* getListDisplayWidget() const override;
|
||||
QJsonObject toJson() const override;
|
||||
std::unique_ptr<LayerStyle> clone() const override;
|
||||
std::pair<PMaterialStyleStroke, PMaterialStyleStroke> strokePair;
|
||||
|
||||
bool enableEachSideIndependent = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue