[editor/style] fix: stroke对于空描边的错误显示

dev-wuyize
ArgonarioD 2023-03-20 21:10:01 +08:00
parent 0543a02dfb
commit d55b49e119
3 changed files with 5 additions and 13 deletions

View File

@ -1,6 +1,4 @@
#include "ColorPicker.h" #include "ColorPicker.h"
#include <QColorDialog>
#include <QDebug>
QString getStyleSheet(const QColor& color) QString getStyleSheet(const QColor& color)
{ {
@ -27,7 +25,6 @@ QColor ColorPicker::getColor() const
void ColorPicker::onClicked() void ColorPicker::onClicked()
{ {
//const QColor newColor = QColorDialog::getColor(this->color, this);
const QColor newColor = ColorHelper::execColorDialog(this->color, this); const QColor newColor = ColorHelper::execColorDialog(this->color, this);
if (newColor.isValid() && this->color != newColor) if (newColor.isValid() && this->color != newColor)
{ {

View File

@ -4,6 +4,7 @@
#include <qtmaterialraisedbutton.h> #include <qtmaterialraisedbutton.h>
#include <limits> #include <limits>
#include <array> #include <array>
#include <QHeaderView>
#include <ranges> #include <ranges>
#include <utility> #include <utility>
@ -28,12 +29,6 @@ StrokeStyleWidget::StrokeStyleWidget(
QWidget* parent QWidget* parent
) : QWidget(parent), stroke(stroke) ) : QWidget(parent), stroke(stroke)
{ {
auto& materialMap = radialStroke(stroke)->materialMap;
if (materialMap.empty())
{
materialMap[1.f] = newMaterial();
}
auto* viewLayout = new QVBoxLayout(this); auto* viewLayout = new QVBoxLayout(this);
this->setLayout(viewLayout); this->setLayout(viewLayout);
@ -115,7 +110,7 @@ void StrokeStyleWidget::initTable(const std::shared_ptr<Renderer::StrokeRadialGr
<< QStringLiteral("´Ö²Ú¶È") << QStringLiteral("´Ö²Ú¶È")
<< QStringLiteral("ÆäËû²Ù×÷"); << QStringLiteral("ÆäËû²Ù×÷");
strokeTable->setHorizontalHeaderLabels(headers); strokeTable->setHorizontalHeaderLabels(headers);
strokeTable->setMinimumHeight(strokeTable->rowHeight(0) * 5); strokeTable->setMinimumHeight(strokeTable->horizontalHeader()->height() * 6);
strokeTable->setMinimumWidth(strokeTable->sizeHint().width()); strokeTable->setMinimumWidth(strokeTable->sizeHint().width());
int row = 0; int row = 0;
// ÄÚÈÝ // ÄÚÈÝ
@ -131,7 +126,7 @@ void StrokeStyleWidget::initTable(const std::shared_ptr<Renderer::StrokeRadialGr
void StrokeStyleWidget::initAddButton() void StrokeStyleWidget::initAddButton()
{ {
this->addButton = new QtMaterialRaisedButton("+", strokeTable); this->addButton = new QtMaterialRaisedButton("+", strokeTable);
addButton->setFixedHeight(this->strokeTable->rowHeight(0)); addButton->setFixedHeight(30);
addButton->setBackgroundColor(ColorHelper::instance().getPrimary1()); addButton->setBackgroundColor(ColorHelper::instance().getPrimary1());
connect(addButton, &QtMaterialRaisedButton::clicked, [this] { connect(addButton, &QtMaterialRaisedButton::clicked, [this] {
handlingRowInsert = true; handlingRowInsert = true;

View File

@ -19,8 +19,8 @@ using Renderer::MaterialStyleFill;
QString getDisplayName() const override { return QStringLiteral(display_name); } \ QString getDisplayName() const override { return QStringLiteral(display_name); } \
static QString typeName() { return type_name; } \ static QString typeName() { return type_name; } \
QString getTypeName() const override { return type_name; } QString getTypeName() const override { return type_name; }
#define radialStroke(stroke) std::static_pointer_cast<Renderer::StrokeRadialGradient>(stroke->materialStroke) #define radialStroke(stroke) std::static_pointer_cast<Renderer::StrokeRadialGradient>((stroke)->materialStroke)
#define plainFill(fill) std::static_pointer_cast<Renderer::FillPlain>(fill->materialFill) #define plainFill(fill) std::static_pointer_cast<Renderer::FillPlain>((fill)->materialFill)
class LayerStyle : public Renderer::ElementStyle class LayerStyle : public Renderer::ElementStyle
{ {