diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp index 0cb0e16e0b..ba6f09c866 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp @@ -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 diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h index 7818894f66..c7cc5165fd 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h @@ -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 calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { return QList(); }