From 1002bcb398139a5724e866565dde6bfe167db895 Mon Sep 17 00:00:00 2001 From: Rahul Paul <179798584+Mr-Rahul-Paul@users.noreply.github.com> Date: Mon, 29 Dec 2025 22:04:29 +0530 Subject: [PATCH] [MOD] Fix premature evaluation and recursive updates in Image Plane Settings (#26390) * Fixed image editor * decoupled the chnage height and width fns * final fixes --- src/Gui/TaskView/TaskImage.cpp | 16 ++++++++++------ src/Gui/TaskView/TaskImage.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Gui/TaskView/TaskImage.cpp b/src/Gui/TaskView/TaskImage.cpp index 4804cb180e..53490be743 100644 --- a/src/Gui/TaskView/TaskImage.cpp +++ b/src/Gui/TaskView/TaskImage.cpp @@ -106,9 +106,9 @@ void TaskImage::connectSignals() connect(ui->sliderTransparency, qOverload(&QSlider::valueChanged), this, &TaskImage::changeTransparency); - connect(ui->spinBoxWidth, qOverload(&QuantitySpinBox::valueChanged), + connect(ui->spinBoxWidth, &QuantitySpinBox::editingFinished, this, &TaskImage::changeWidth); - connect(ui->spinBoxHeight, qOverload(&QuantitySpinBox::valueChanged), + connect(ui->spinBoxHeight, &QuantitySpinBox::editingFinished, this, &TaskImage::changeHeight); connect(ui->pushButtonScale, &QPushButton::clicked, this, &TaskImage::onInteractiveScale); @@ -150,25 +150,29 @@ void TaskImage::changeTransparency(int val) } } -void TaskImage::changeWidth(double val) +void TaskImage::changeWidth() { if (!feature.expired()) { + double val = ui->spinBoxWidth->value().getValue(); feature->XSize.setValue(val); if (ui->checkBoxRatio->isChecked()) { - QSignalBlocker block(ui->spinBoxWidth); + feature->YSize.setValue(val / aspectRatio); + QSignalBlocker block(ui->spinBoxHeight); ui->spinBoxHeight->setValue(val / aspectRatio); } } } -void TaskImage::changeHeight(double val) +void TaskImage::changeHeight() { if (!feature.expired()) { + double val = ui->spinBoxHeight->value().getValue(); feature->YSize.setValue(val); if (ui->checkBoxRatio->isChecked()) { - QSignalBlocker block(ui->spinBoxHeight); + feature->XSize.setValue(val * aspectRatio); + QSignalBlocker block(ui->spinBoxWidth); ui->spinBoxWidth->setValue(val * aspectRatio); } } diff --git a/src/Gui/TaskView/TaskImage.h b/src/Gui/TaskView/TaskImage.h index 81b21b6fe7..8f0c0d6540 100644 --- a/src/Gui/TaskView/TaskImage.h +++ b/src/Gui/TaskView/TaskImage.h @@ -120,8 +120,8 @@ private: private: void changeTransparency(int val); - void changeWidth(double val); - void changeHeight(double val); + void changeWidth(); + void changeHeight(); private: std::unique_ptr ui;