Reintroduce "#4308 System : Add virtual function childFieldChangedByUi"

This reverts commit 91022a7535.
This commit is contained in:
Magne Sjaastad 2019-04-10 10:57:18 +02:00
parent 91022a7535
commit 4c46573fc9
2 changed files with 23 additions and 4 deletions

View File

@ -58,11 +58,27 @@ void PdmUiFieldHandle::notifyFieldChanged(const QVariant& oldFieldValue, const Q
PdmFieldHandle* fieldHandle = this->fieldHandle();
CAF_ASSERT(fieldHandle && fieldHandle->ownerObject());
PdmUiObjectHandle* uiObjHandle = uiObj(fieldHandle->ownerObject());
if (uiObjHandle)
PdmObjectHandle* ownerObjectHandle = fieldHandle->ownerObject();
{
uiObjHandle->fieldChangedByUi(fieldHandle, oldFieldValue, newFieldValue);
uiObjHandle->updateConnectedEditors();
PdmUiObjectHandle* uiObjHandle = uiObj(ownerObjectHandle);
if (uiObjHandle)
{
uiObjHandle->fieldChangedByUi(fieldHandle, oldFieldValue, newFieldValue);
uiObjHandle->updateConnectedEditors();
}
}
if (ownerObjectHandle->parentField() && ownerObjectHandle->parentField()->ownerObject())
{
PdmUiObjectHandle* uiObjHandle = uiObj(ownerObjectHandle->parentField()->ownerObject());
if (uiObjHandle)
{
uiObjHandle->childFieldChangedByUi(ownerObjectHandle->parentField());
// If updateConnectedEditors() is required, this has to be called in childFieldChangedByUi()
}
}
// Update field editors

View File

@ -58,6 +58,9 @@ public: // Virtual
/// Method to reimplement to catch when the field has changed due to setUiValue()
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) {}
/// Method to reimplement to catch when a field in a contained object has changed due to setUiValue()
virtual void childFieldChangedByUi(const caf::PdmFieldHandle* changedChildField) {}
/// Method to re-implement to supply option values for a specific field
virtual QList<caf::PdmOptionItemInfo>
calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { return QList<PdmOptionItemInfo>(); }