mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
#922 AppFwk : Added setValueWithFieldChanged
This commit is contained in:
parent
522ae9998f
commit
96e532696e
@ -74,6 +74,7 @@ public:
|
|||||||
|
|
||||||
DataType value() const { return m_fieldValue; }
|
DataType value() const { return m_fieldValue; }
|
||||||
void setValue(const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; }
|
void setValue(const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; }
|
||||||
|
void setValueWithFieldChanged(const DataType& fieldValue);
|
||||||
|
|
||||||
// Implementation of PdmValueField interface
|
// Implementation of PdmValueField interface
|
||||||
|
|
||||||
@ -106,4 +107,30 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
template<typename DataType >
|
||||||
|
void caf::PdmDataValueField<DataType>::setValueWithFieldChanged(const DataType& fieldValue)
|
||||||
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
|
PdmUiFieldHandle* uiFieldHandle = uiCapability();
|
||||||
|
if (uiFieldHandle)
|
||||||
|
{
|
||||||
|
QVariant oldValue = uiFieldHandle->toUiBasedQVariant();
|
||||||
|
|
||||||
|
m_fieldValue = fieldValue;
|
||||||
|
|
||||||
|
QVariant newUiBasedQVariant = uiFieldHandle->toUiBasedQVariant();
|
||||||
|
|
||||||
|
uiFieldHandle->notifyFieldChanged(oldValue, newUiBasedQVariant);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_fieldValue = fieldValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace caf
|
} // End of namespace caf
|
||||||
|
Loading…
Reference in New Issue
Block a user