From 73719905db22a3d09664f02fc072059c940d693d Mon Sep 17 00:00:00 2001 From: ArgonarioD Date: Sat, 18 Mar 2023 03:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E4=B8=80=E4=BA=9Bba?= =?UTF-8?q?d=20smells?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StrokeStyleWidget.cpp | 20 +++++++++---------- .../src/Editor/LayerStyle.cpp | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp index fabcf6a..670e185 100644 --- a/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp +++ b/ArchitectureColoredPainting/src/Editor/EditorWidgetComponent/StrokeStyleWidget.cpp @@ -15,12 +15,12 @@ StrokeStyleWidget::StrokeStyleWidget( QWidget* parent ) : QWidget(parent), stroke(stroke) { - QVBoxLayout* viewLayout = new QVBoxLayout(this); + auto* viewLayout = new QVBoxLayout(this); this->setLayout(viewLayout); initStrokeSettings(); - QWidget* strokeProperties = new QWidget(this); - QHBoxLayout* strokePropertiesLayout = new QHBoxLayout(strokeProperties); + auto* strokeProperties = new QWidget(this); + auto* strokePropertiesLayout = new QHBoxLayout(strokeProperties); strokePropertiesLayout->setMargin(0); strokeProperties->setLayout(strokePropertiesLayout); @@ -72,7 +72,7 @@ void StrokeStyleWidget::initStrokeSettings() this->widthField = new QtMaterialTextField(this); widthField->setLabel(QStringLiteral("±¾²àÃè±ß¿í¶È")); widthField->setText(QString::number(stroke->halfWidth)); - QDoubleValidator* widthValidator = new QDoubleValidator(0.1, std::numeric_limits::max(), 3, widthField); + auto* widthValidator = new QDoubleValidator(0.1, std::numeric_limits::max(), 3, widthField); widthValidator->setNotation(QDoubleValidator::StandardNotation); widthField->setValidator(widthValidator); connect(widthField, &QtMaterialTextField::textChanged, [this](const QString& changed) { @@ -139,30 +139,30 @@ void StrokeStyleWidget::initTable(std::shared_ptrsetData(Qt::EditRole, width); strokeTable->setItem(row, COLUMN_WIDTH, widthItem); QColor* colorPtr = &(material.color); - QTableWidgetItem* colorItem = new QTableWidgetItem; + auto* colorItem = new QTableWidgetItem; colorItem->setData(Qt::DisplayRole, *colorPtr); strokeTable->setItem(row, COLUMN_COLOR, colorItem); - ColorPicker* colorPicker = new ColorPicker(*colorPtr, strokeTable); + auto* colorPicker = new ColorPicker(*colorPtr, strokeTable); strokeTable->setCellWidget(row, COLUMN_COLOR, colorPicker); connect(colorPicker, &ColorPicker::colorChanged, [this, colorPtr](QColor color) { *colorPtr = color; this->strokeTable->update(); }); - QTableWidgetItem* metallicItem = new QTableWidgetItem; + auto* metallicItem = new QTableWidgetItem; metallicItem->setData(Qt::EditRole, material.metallicF()); strokeTable->setItem(row, COLUMN_METALLIC, metallicItem); - QTableWidgetItem* roughnessItem = new QTableWidgetItem; + auto* roughnessItem = new QTableWidgetItem; roughnessItem->setData(Qt::EditRole, material.roughnessF()); strokeTable->setItem(row, COLUMN_ROUGHNESS, roughnessItem); - QtMaterialRaisedButton* removeButton = new QtMaterialRaisedButton("-", strokeTable); + auto* removeButton = new QtMaterialRaisedButton("-", strokeTable); removeButton->setBackgroundColor(QtMaterialStyle::instance().themeColor("primary1")); removeButton->setFixedSize(20, 20); strokeTable->setCellWidget(row, COLUMN_OPERATIONS, removeButton); diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp index 47856be..5be1b72 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp @@ -41,21 +41,21 @@ std::vector StrokeElementLayerStyle::toBaseStyles() const QWidget* StrokeElementLayerStyle::getInputWidget() { - QWidget* w = new QWidget; - QListView* materialList = new QListView; + auto* w = new QWidget; + auto* materialList = new QListView; - QVBoxLayout* layout = new QVBoxLayout(w); + auto* layout = new QVBoxLayout(w); layout->setMargin(0); - StrokeStyleWidget* leftStrokeView = new StrokeStyleWidget(this->strokePair.first, w); + auto* leftStrokeView = new StrokeStyleWidget(this->strokePair.first, w); layout->addWidget(leftStrokeView); - QtMaterialCheckBox* checkEachSideIndependent = new QtMaterialCheckBox(w); + auto* checkEachSideIndependent = new QtMaterialCheckBox(w); checkEachSideIndependent->setText(QStringLiteral("ÓÒ²à¶ÀÁ¢Ãè±ß")); checkEachSideIndependent->setChecked(enableEachSideIndependent); layout->addWidget(checkEachSideIndependent); - StrokeStyleWidget* rightStrokeView = new StrokeStyleWidget(this->strokePair.second, w); + auto* rightStrokeView = new StrokeStyleWidget(this->strokePair.second, w); layout->addWidget(rightStrokeView); rightStrokeView->setDisabled(!this->enableEachSideIndependent); @@ -262,17 +262,17 @@ std::vector FillElementLayerStyle::toBaseStyles() const QWidget* FillElementLayerStyle::getInputWidget() { // TODO - QLineEdit* name = new QLineEdit; + auto* name = new QLineEdit; name->setText(QStringLiteral("Ìî³ä")); return name; } QWidget* FillElementLayerStyle::getListDisplayWidget() const { - QWidget* w = new QWidget; - QLabel* name = new QLabel(w); + auto* w = new QWidget; + auto* name = new QLabel(w); name->setText(QStringLiteral("Ìî³ä")); - QHBoxLayout* layout = new QHBoxLayout(w); + auto* layout = new QHBoxLayout(w); layout->setMargin(0); layout->addWidget(name); return w;