#1340 AppFwk : Improve how defineUiOrdering handles remaining fields

This commit is contained in:
Magne Sjaastad 2017-03-21 13:47:53 +01:00
parent 98bb97ea34
commit df3ef7106d
17 changed files with 29 additions and 22 deletions

View File

@ -191,7 +191,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&defaultCurveFilter);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -207,7 +207,7 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
}
statGroup->add(&m_statisticsCellRange);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -273,7 +273,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
uiOrdering.add(&useZVariable);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -206,7 +206,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.add(&m_upperBound);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
updateReadOnlyStateOfAllFields();
updateRangeLabel();

View File

@ -945,7 +945,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
}
uiOrdering.add(&m_resultVariableUiField);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -353,7 +353,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -150,7 +150,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
updateReadOnlyStateOfAllFields();
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -119,7 +119,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
if (m_isTimeLapseResultUiField())
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -228,7 +228,7 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
updateWellExtentDefaultValue();
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -321,7 +321,7 @@ void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
group->add(&ternaryRangeSummary);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -420,7 +420,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -483,7 +483,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_showTrackLegends);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}

View File

@ -462,7 +462,7 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
uiOrdering.add(&m_plotAxis);
uiOrdering.setForgetRemainingFields(true); // For now.
uiOrdering.skipRemainingFields(true); // For now.
}
//--------------------------------------------------------------------------------------------------

View File

@ -225,7 +225,7 @@ void RimSummaryCurveFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
uiOrdering.add(&m_autoApplyChangesToPlot);
uiOrdering.add(&m_applyButtonField);
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -301,7 +301,7 @@ void RimSummaryTimeAxisProperties::defineUiOrdering(QString uiConfigName, caf::P
timeGroup->add(&m_visibleTimeRangeMin);
}
uiOrdering.setForgetRemainingFields(true);
uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -37,9 +37,12 @@ PdmUiObjectHandle* uiObj(PdmObjectHandle* obj)
//--------------------------------------------------------------------------------------------------
void PdmUiObjectHandle::uiOrdering(QString uiConfigName, PdmUiOrdering& uiOrdering)
{
#if 1
// Restore state for includeRemainingFields, as this flag
// can be changed in defineUiOrdering()
bool includeRemaining_originalState = uiOrdering.includeRemainingFields();
this->defineUiOrdering(uiConfigName, uiOrdering);
if (!uiOrdering.forgetRemainingFields())
if (uiOrdering.includeRemainingFields())
{
// Add the remaining Fields To UiConfig
std::vector<PdmFieldHandle*> fields;
@ -53,7 +56,11 @@ void PdmUiObjectHandle::uiOrdering(QString uiConfigName, PdmUiOrdering& uiOrderi
}
}
}
#endif
// Restore incoming value
uiOrdering.skipRemainingFields(!includeRemaining_originalState);
CAF_ASSERT(includeRemaining_originalState == uiOrdering.includeRemainingFields());
}
//--------------------------------------------------------------------------------------------------

View File

@ -55,7 +55,7 @@ class PdmObjectHandle;
class PdmUiOrdering
{
public:
PdmUiOrdering(): m_forgetRemainingFields(false) { };
PdmUiOrdering(): m_skipRemainingFields(false) { };
virtual ~PdmUiOrdering();
PdmUiOrdering(const PdmUiOrdering&) = delete;
@ -68,8 +68,8 @@ public:
void add(const PdmFieldHandle* field);
void add(const PdmObjectHandle* obj);
bool forgetRemainingFields() const { return m_forgetRemainingFields; }
void setForgetRemainingFields(bool val) { m_forgetRemainingFields = val; }
bool includeRemainingFields() const { return !m_skipRemainingFields; }
void skipRemainingFields(bool val) { m_skipRemainingFields = val; }
const std::vector<PdmUiItem*>& uiItems() const { return m_ordering; }
bool contains(const PdmUiItem* item) const;
@ -77,7 +77,7 @@ public:
private:
std::vector<PdmUiItem*> m_ordering; ///< The order of groups and fields
std::vector<PdmUiGroup*> m_createdGroups; ///< Owned PdmUiGroups, for mem management
bool m_forgetRemainingFields;
bool m_skipRemainingFields;
};
//==================================================================================================