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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user