From ad649bc6852746ffa22c27ee6e298e35a44fa2a4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 9 Nov 2022 09:36:43 +0100 Subject: [PATCH] Gui: use QSignalBlocker in DlgDisplayPropertiesImp --- src/Gui/DlgDisplayPropertiesImp.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index b974a23683..c9d3b09f90 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -25,6 +25,7 @@ # include # include # include +# include #endif #include @@ -68,9 +69,8 @@ public: App::Color c = static_cast(prop)->getValue(); QColor shape; shape.setRgb((int)(c.r * 255.0f), (int)(c.g * 255.0f), (int)(c.b * 255.0f)); - bool blocked = buttonColor->blockSignals(true); + QSignalBlocker block(buttonColor); buttonColor->setColor(shape); - buttonColor->blockSignals(blocked); hasElementColor = true; break; } @@ -85,9 +85,8 @@ public: for (const auto & view : views) { App::Property* prop = view->getPropertyByName(property); if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) { - bool blocked = spinbox->blockSignals(true); + QSignalBlocker block(spinbox); spinbox->setValue((int)static_cast(prop)->getValue()); - spinbox->blockSignals(blocked); hasDrawStyle = true; break; } @@ -102,13 +101,11 @@ public: for (const auto & view : views) { App::Property* prop = view->getPropertyByName(property); if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { - bool blocked = spinbox->blockSignals(true); + QSignalBlocker blockSpinBox(spinbox); spinbox->setValue(static_cast(prop)->getValue()); - spinbox->blockSignals(blocked); - blocked = slider->blockSignals(true); + QSignalBlocker blockSlider(slider); slider->setValue(static_cast(prop)->getValue()); - slider->blockSignals(blocked); hasTransparency = true; break; }