[stroke] fix: 新增描边时无法正确应用颜色修改的问题

dev-LayerStyle
ArgonarioD 2023-03-16 01:54:50 +08:00
parent e72ba7ebbd
commit 8809daaddd
2 changed files with 5 additions and 5 deletions

View File

@ -126,7 +126,7 @@ void StrokeStyleWidget::initTable(std::shared_ptr<Renderer::StrokeRadialGradient
(*materialMap)[newWidth] = newMaterial; (*materialMap)[newWidth] = newMaterial;
int newRow = this->strokeTable->rowCount() - 1; int newRow = this->strokeTable->rowCount() - 1;
this->strokeTable->insertRow(newRow); this->strokeTable->insertRow(newRow);
setTableRow(newRow, newWidth, newMaterial); setTableRow(newRow, newWidth, (*materialMap)[newWidth]);
this->strokeTable->update(); this->strokeTable->update();
handlingRowInsert = false; handlingRowInsert = false;
}); });
@ -149,7 +149,7 @@ void StrokeStyleWidget::setTableRow(int row, float width, Renderer::Material& ma
strokeTable->setCellWidget(row, COLUMN_COLOR, colorPicker); strokeTable->setCellWidget(row, COLUMN_COLOR, colorPicker);
connect(colorPicker, &ColorPicker::colorChanged, [this, colorPtr](QColor color) { connect(colorPicker, &ColorPicker::colorChanged, [this, colorPtr](QColor color) {
*colorPtr = color; *colorPtr = color;
this->strokeTable->update(); this->strokeTable->update();
}); });
QTableWidgetItem* metallicItem = new QTableWidgetItem; QTableWidgetItem* metallicItem = new QTableWidgetItem;
@ -176,7 +176,7 @@ void StrokeStyleWidget::onCurrentItemChanged(QTableWidgetItem* current, QTableWi
int column = current->column(); int column = current->column();
if (column != COLUMN_COLOR && column != COLUMN_OPERATIONS) if (column != COLUMN_COLOR && column != COLUMN_OPERATIONS)
{ {
this->currentItemValue = current->text(); this->currentItemValue = current->data(Qt::EditRole);
} }
} }
@ -190,7 +190,7 @@ void StrokeStyleWidget::onCellChanged(int row, int column)
changedItem->setData(Qt::EditRole, this->currentItemValue.toFloat()); changedItem->setData(Qt::EditRole, this->currentItemValue.toFloat());
return; return;
} }
auto changedWidth = strokeTable->item(row, COLUMN_WIDTH)->text().toFloat(); auto changedWidth = strokeTable->item(row, COLUMN_WIDTH)->data(Qt::EditRole).toFloat();
switch (column) switch (column)
{ {
case COLUMN_WIDTH: case COLUMN_WIDTH:

View File

@ -10,7 +10,7 @@ class StrokeStyleWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
private: private:
QString currentItemValue; QVariant currentItemValue;
QtMaterialCheckBox* enableGradual; QtMaterialCheckBox* enableGradual;
QComboBox* endTypeBox; QComboBox* endTypeBox;