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

View File

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