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
This commit is contained in:
Steven James
2025-11-09 18:45:57 -05:00
committed by GitHub
parent 484c724ac6
commit 5c464e0746
2 changed files with 7 additions and 7 deletions

View File

@@ -1381,12 +1381,16 @@ void PropertyBoolItem::setValue(const QVariant& value)
}
QWidget* PropertyBoolItem::createEditor(QWidget* parent,
const std::function<void()>& /*method*/,
const std::function<void()>& 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;
}

View File

@@ -187,10 +187,6 @@ bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev)
auto parentEditor = qobject_cast<PropertyEditor*>(this->parent());
if (parentEditor && parentEditor->activeEditor == checkBox) {
checkBox->toggle();
// Delay valueChanged to ensure proper recomputation
QTimer::singleShot(0, this, [this]() {
valueChanged();
});
}
}
}