From d75f0175226a4c81bef463dfef8c14f6837ea8d7 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Wed, 3 Dec 2025 17:15:59 -0500 Subject: [PATCH] CModelEditorWindow: Reduce string churn We can just pass by reference. --- src/Editor/ModelEditor/CModelEditorWindow.cpp | 12 ++++++------ src/Editor/ModelEditor/CModelEditorWindow.h | 4 ++-- src/Editor/Widgets/WColorPicker.cpp | 4 ++-- src/Editor/Widgets/WColorPicker.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Editor/ModelEditor/CModelEditorWindow.cpp b/src/Editor/ModelEditor/CModelEditorWindow.cpp index 6484a44d..c390dda3 100644 --- a/src/Editor/ModelEditor/CModelEditorWindow.cpp +++ b/src/Editor/ModelEditor/CModelEditorWindow.cpp @@ -109,10 +109,10 @@ CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent) connect(ui->EnableDynamicLightingCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->SourceBlendComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->DestBlendComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); - connect(ui->KonstColorPickerA, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); - connect(ui->KonstColorPickerB, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); - connect(ui->KonstColorPickerC, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); - connect(ui->KonstColorPickerD, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerA, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerB, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerC, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerD, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->PassTable, &QTableWidget::cellClicked, this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->TevKColorSelComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->TevKAlphaSelComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); @@ -541,7 +541,7 @@ void CModelEditorWindow::UpdateMaterial(bool Value) } } -void CModelEditorWindow::UpdateMaterial(QColor Color) +void CModelEditorWindow::UpdateMaterial(const QColor& Color) { // This function takes input from WColorPickers if (!mpCurrentMat) return; @@ -568,7 +568,7 @@ void CModelEditorWindow::UpdateMaterial(QColor Color) } } -void CModelEditorWindow::UpdateMaterial(QString Value) +void CModelEditorWindow::UpdateMaterial(const QString& Value) { // This function takes input from WResourceSelectors if (!mpCurrentMat) return; diff --git a/src/Editor/ModelEditor/CModelEditorWindow.h b/src/Editor/ModelEditor/CModelEditorWindow.h index ff3fdcb5..4f3d1064 100644 --- a/src/Editor/ModelEditor/CModelEditorWindow.h +++ b/src/Editor/ModelEditor/CModelEditorWindow.h @@ -93,8 +93,8 @@ public slots: void UpdateMaterial(int ValueA, int ValueB); void UpdateMaterial(double Value); void UpdateMaterial(bool Value); - void UpdateMaterial(QColor Value); - void UpdateMaterial(QString Value); + void UpdateMaterial(const QColor& Color); + void UpdateMaterial(const QString& Value); void UpdateUI(int Value); void UpdateAnimParamUI(EUVAnimMode Mode); diff --git a/src/Editor/Widgets/WColorPicker.cpp b/src/Editor/Widgets/WColorPicker.cpp index ef546f9f..b8f0f51b 100644 --- a/src/Editor/Widgets/WColorPicker.cpp +++ b/src/Editor/Widgets/WColorPicker.cpp @@ -85,7 +85,7 @@ QColor WColorPicker::Color() const return mColor; } -void WColorPicker::SetColor(QColor Color) +void WColorPicker::SetColor(const QColor& Color) { if (mColor != Color) { @@ -95,7 +95,7 @@ void WColorPicker::SetColor(QColor Color) } } -void WColorPicker::DialogColorChanged(QColor NewColor) +void WColorPicker::DialogColorChanged(const QColor& NewColor) { mColor = NewColor; emit ColorChanged(mColor); diff --git a/src/Editor/Widgets/WColorPicker.h b/src/Editor/Widgets/WColorPicker.h index 2c4f9e1d..c6ebd2c1 100644 --- a/src/Editor/Widgets/WColorPicker.h +++ b/src/Editor/Widgets/WColorPicker.h @@ -18,14 +18,14 @@ public: void mousePressEvent(QMouseEvent*) override; void mouseReleaseEvent(QMouseEvent* pEvent) override; QColor Color() const; - void SetColor(QColor Color); + void SetColor(const QColor& Color); signals: - void ColorChanged(QColor NewColor); - void ColorEditComplete(QColor NewColor); + void ColorChanged(const QColor& NewColor); + void ColorEditComplete(const QColor& NewColor); private slots: - void DialogColorChanged(QColor NewColor); + void DialogColorChanged(const QColor& NewColor); void DialogRejected(); };