diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp index dfd62c9..00283ca 100644 --- a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp +++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp @@ -126,7 +126,7 @@ void StrokeStyleWidget::initTable(std::shared_ptrstrokeTable->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: diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.h b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.h index cda3ab1..6d5dbdd 100644 --- a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.h +++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.h @@ -10,7 +10,7 @@ class StrokeStyleWidget : public QWidget { Q_OBJECT private: - QString currentItemValue; + QVariant currentItemValue; QtMaterialCheckBox* enableGradual; QComboBox* endTypeBox;