Refactor LayoutOptions to improve readability

* Make it possible to use designated initializer list
- remove default constructor
- move static member to outer scope

* Add helper function to add field on same row
This commit is contained in:
Magne Sjaastad
2023-11-10 14:48:56 +01:00
committed by GitHub
parent 860f086af6
commit 678a368361
30 changed files with 198 additions and 204 deletions

View File

@@ -448,7 +448,7 @@ void RimEnsembleCurveFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiO
else if ( m_filterMode() == FilterMode::BY_OBJECTIVE_FUNCTION )
{
uiOrdering.add( &m_objectiveValuesSummaryAddressesUiField );
uiOrdering.add( &m_objectiveValuesSelectSummaryAddressPushButton, { false, 1, 0 } );
uiOrdering.add( &m_objectiveValuesSelectSummaryAddressPushButton, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
{
auto equationGroup = uiOrdering.addNewGroup( "Equation" );
m_objectiveFunction->uiOrdering( "", *equationGroup );

View File

@@ -1130,7 +1130,7 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
if ( !isXAxisSummaryVector() )
{
@@ -1327,7 +1327,8 @@ void RimEnsembleCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrdering )
if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION )
{
colorsGroup->add( &m_objectiveValuesSummaryAddressesUiField );
colorsGroup->add( &m_objectiveValuesSelectSummaryAddressPushButton, { false, 1, 0 } );
colorsGroup->add( &m_objectiveValuesSelectSummaryAddressPushButton,
{ .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
{
auto equationGroup = colorsGroup->addNewGroup( "Equation" );

View File

@@ -350,15 +350,15 @@ void RimSummaryAddressSelector::defineUiOrdering( QString uiConfigName, caf::Pdm
// Update the UI field, as this is not serialized to file
m_summaryAddressUiField = m_summaryAddress->address();
uiOrdering.add( &m_summaryAddressUiField, { true, 2, 1 } );
uiOrdering.add( &m_pushButtonSelectSummaryAddress, { false, 1, 0 } );
uiOrdering.add( &m_summaryAddressUiField, { .newRow = true, .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
uiOrdering.add( &m_pushButtonSelectSummaryAddress, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
if ( m_showResampling )
{
uiOrdering.add( &m_resamplingPeriod, { true, 3, 1 } );
uiOrdering.add( &m_resamplingPeriod, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
}
uiOrdering.add( &m_plotAxisProperties, { true, 3, 1 } );
uiOrdering.add( &m_plotAxisProperties, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
uiOrdering.skipRemainingFields( true );
}

View File

@@ -902,22 +902,22 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
{
QString curveDataGroupName = "Summary Vector";
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( curveDataGroupName, "curveDataGroupName" );
curveDataGroup->add( &m_yValuesSummaryCase, { true, 3, 1 } );
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
curveDataGroup->add( &m_yValuesResampling, { true, 3, 1 } );
curveDataGroup->add( &m_yPlotAxisProperties, { true, 3, 1 } );
curveDataGroup->add( &m_yValuesSummaryCase, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { .newRow = true, .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
curveDataGroup->add( &m_yValuesResampling, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_yPlotAxisProperties, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_showErrorBars );
}
if ( m_showXAxisGroup )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector X Axis" );
curveDataGroup->add( &m_xAxisType, { true, 3, 1 } );
curveDataGroup->add( &m_xValuesSummaryCase, { true, 3, 1 } );
curveDataGroup->add( &m_xValuesSummaryAddressUiField, { true, 2, 1 } );
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, { false, 1, 0 } );
curveDataGroup->add( &m_xPlotAxisProperties, { true, 3, 1 } );
curveDataGroup->add( &m_xAxisType, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_xValuesSummaryCase, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_xValuesSummaryAddressUiField, { .newRow = true, .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, { .newRow = false, .totalColumnSpan = 1, .leftLabelColumnSpan = 0 } );
curveDataGroup->add( &m_xPlotAxisProperties, { .newRow = true, .totalColumnSpan = 3, .leftLabelColumnSpan = 1 } );
}
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );

View File

@@ -344,17 +344,17 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
uiOrdering.add( &m_filterText );
uiOrdering.add( &m_addressCandidates );
uiOrdering.add( &m_selectedDataSources, false );
uiOrdering.appendToRow( &m_selectedDataSources );
uiOrdering.add( &m_individualPlotPerVector );
uiOrdering.add( &m_individualPlotPerDataSource, false );
uiOrdering.appendToRow( &m_individualPlotPerDataSource );
uiOrdering.add( &m_individualPlotPerObject );
uiOrdering.add( &m_createMultiPlot, false );
uiOrdering.appendToRow( &m_createMultiPlot );
uiOrdering.add( &m_pushButtonAppend );
uiOrdering.add( &m_pushButtonReplace, { false } );
uiOrdering.add( &m_labelB, { false } );
uiOrdering.add( &m_pushButtonNewPlot, { false } );
uiOrdering.appendToRow( &m_pushButtonReplace );
uiOrdering.appendToRow( &m_labelB );
uiOrdering.appendToRow( &m_pushButtonNewPlot );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -802,10 +802,10 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf::
timeGroup->add( &m_timeMode );
if ( m_timeMode() == DATE )
{
timeGroup->add( &m_visibleDateRangeMax, true );
timeGroup->add( &m_visibleTimeRangeMax, false );
timeGroup->add( &m_visibleDateRangeMin, true );
timeGroup->add( &m_visibleTimeRangeMin, false );
timeGroup->add( &m_visibleDateRangeMax );
timeGroup->appendToRow( &m_visibleTimeRangeMax );
timeGroup->add( &m_visibleDateRangeMin );
timeGroup->appendToRow( &m_visibleTimeRangeMin );
}
else
{