From 8809daaddd25483c48693312f0d32e79d709f766 Mon Sep 17 00:00:00 2001 From: ArgonarioD Date: Thu, 16 Mar 2023 01:54:50 +0800 Subject: [PATCH] =?UTF-8?q?[stroke]=20fix:=20=E6=96=B0=E5=A2=9E=E6=8F=8F?= =?UTF-8?q?=E8=BE=B9=E6=97=B6=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E9=A2=9C=E8=89=B2=E4=BF=AE=E6=94=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/EditorWidgetComponent/StrokeStyleWidget.cpp | 8 ++++---- .../src/Editor/EditorWidgetComponent/StrokeStyleWidget.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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;