mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
caf: Added an option on ui fields to not add their value to the list of options if the option does not exist.
This commit is contained in:
parent
336828e48d
commit
c2e62c60ba
@ -176,7 +176,7 @@ QList<PdmOptionItemInfo> caf::PdmFieldUiCap<FieldType>::valueOptions(bool* useOp
|
||||
|
||||
// If not all are found, we have to add the missing to the list, to be able to show it
|
||||
|
||||
if (!foundAllFieldValues)
|
||||
if (isAutoAddingOptionFromValue() && !foundAllFieldValues)
|
||||
{
|
||||
if (uiBasedQVariant.type() != QVariant::List) // Single value field
|
||||
{
|
||||
|
@ -12,7 +12,8 @@ namespace caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiFieldHandle::PdmUiFieldHandle(PdmFieldHandle* owner, bool giveOwnership)
|
||||
PdmUiFieldHandle::PdmUiFieldHandle(PdmFieldHandle* owner, bool giveOwnership):
|
||||
m_isAutoAddingOptionFromValue(true)
|
||||
{
|
||||
m_owner = owner;
|
||||
owner->addCapability(this, giveOwnership);
|
||||
|
@ -24,11 +24,14 @@ public:
|
||||
virtual QList<PdmOptionItemInfo>
|
||||
valueOptions(bool* useOptionsOnly) { return QList<PdmOptionItemInfo>(); }
|
||||
|
||||
virtual QVariant toUiBasedQVariant() const { return QVariant(); }
|
||||
virtual QVariant toUiBasedQVariant() const { return QVariant(); }
|
||||
void notifyFieldChanged(const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant);
|
||||
|
||||
bool isAutoAddingOptionFromValue() { return m_isAutoAddingOptionFromValue; }
|
||||
void setAutoAddingOptionFromValue(bool isAddingValue) { m_isAutoAddingOptionFromValue = isAddingValue;}
|
||||
private:
|
||||
PdmFieldHandle* m_owner;
|
||||
PdmFieldHandle* m_owner;
|
||||
bool m_isAutoAddingOptionFromValue;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user