From 9ebb49d1f0e84a03ac3d49a0847eeae2cb235a6c Mon Sep 17 00:00:00 2001 From: Steven James Date: Sun, 9 Nov 2025 18:45:57 -0500 Subject: [PATCH] Fix setting Bool value in VarSet add properties dialog. (#24873) * Connect Bool checkbox checkStateChanged to the editor callback so changes will actually happen. Make the change compatible with Qt versions <6.7.0 * Remove delayed singleshot-value changed from the event filter for Checkbox as suggested by @pieterhijma * Remove no longer relevent comment --- src/Gui/propertyeditor/PropertyItem.cpp | 10 +++++++--- src/Gui/propertyeditor/PropertyItemDelegate.cpp | 4 ---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 6566ad6e59..ef9a2a15de 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -1381,12 +1381,16 @@ void PropertyBoolItem::setValue(const QVariant& value) } QWidget* PropertyBoolItem::createEditor(QWidget* parent, - const std::function& /*method*/, + const std::function& method, FrameOption /*frameOption*/) const { - // The checkbox is basically artificial (it is not rendered). Other code handles the callback, - // etc. auto checkbox = new QCheckBox(parent); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) + QObject::connect(checkbox, &QCheckBox::stateChanged, method); +#else + QObject::connect(checkbox, &QCheckBox::checkStateChanged, method); +#endif + return checkbox; } diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index 7b1116fbd6..02dc928911 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -187,10 +187,6 @@ bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev) auto parentEditor = qobject_cast(this->parent()); if (parentEditor && parentEditor->activeEditor == checkBox) { checkBox->toggle(); - // Delay valueChanged to ensure proper recomputation - QTimer::singleShot(0, this, [this]() { - valueChanged(); - }); } } }