mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add convenience function to set number format to fixed with two decimals
This commit is contained in:
parent
d8bd7bc81a
commit
337584025c
@ -392,12 +392,7 @@ void RimGridCrossPlotRegressionCurve::defineEditorAttribute( const caf::PdmField
|
||||
}
|
||||
else if ( field == &m_minExtrapolationRangeX || field == &m_maxExtrapolationRangeX )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
{
|
||||
doubleAttr->m_decimals = 2;
|
||||
doubleAttr->m_numberFormat = caf::PdmUiDoubleValueEditorAttribute::NumberFormat::FIXED;
|
||||
}
|
||||
caf::PdmUiDoubleValueEditorAttribute::testAndSetFixedWithTwoDecimals( attribute );
|
||||
}
|
||||
|
||||
else if ( field == &m_expressionText )
|
||||
|
@ -1228,12 +1228,7 @@ void RimDepthTrackPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
{
|
||||
if ( field == &m_minVisibleDepth || field == &m_maxVisibleDepth )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
{
|
||||
doubleAttr->m_decimals = 2;
|
||||
doubleAttr->m_numberFormat = caf::PdmUiDoubleValueEditorAttribute::NumberFormat::FIXED;
|
||||
}
|
||||
caf::PdmUiDoubleValueEditorAttribute::testAndSetFixedWithTwoDecimals( attribute );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -896,12 +896,7 @@ void RimStimPlanModel::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
{
|
||||
if ( field == &m_formationDip || field == &m_barrierDip || field == &m_distanceToBarrier )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
{
|
||||
doubleAttr->m_decimals = 2;
|
||||
doubleAttr->m_numberFormat = caf::PdmUiDoubleValueEditorAttribute::NumberFormat::FIXED;
|
||||
}
|
||||
caf::PdmUiDoubleValueEditorAttribute::testAndSetFixedWithTwoDecimals( attribute );
|
||||
}
|
||||
|
||||
if ( field == &m_MD )
|
||||
|
@ -307,12 +307,7 @@ void RimStimPlanModelTemplate::defineEditorAttribute( const caf::PdmFieldHandle*
|
||||
{
|
||||
if ( field == &m_stressDepth || field == &m_verticalStress )
|
||||
{
|
||||
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
|
||||
if ( doubleAttr )
|
||||
{
|
||||
doubleAttr->m_decimals = 2;
|
||||
doubleAttr->m_numberFormat = caf::PdmUiDoubleValueEditorAttribute::NumberFormat::FIXED;
|
||||
}
|
||||
caf::PdmUiDoubleValueEditorAttribute::testAndSetFixedWithTwoDecimals( attribute );
|
||||
}
|
||||
|
||||
if ( field == &m_faciesInitialPressureConfigs )
|
||||
|
@ -66,6 +66,21 @@ public:
|
||||
m_numberFormat = NumberFormat::AUTOMATIC;
|
||||
}
|
||||
|
||||
void setFixedWithTwoDecimals()
|
||||
{
|
||||
m_decimals = 2;
|
||||
m_numberFormat = NumberFormat::FIXED;
|
||||
}
|
||||
|
||||
// Convenience function to set the number format to fixed with two decimals
|
||||
static void testAndSetFixedWithTwoDecimals( caf::PdmUiEditorAttribute* attr )
|
||||
{
|
||||
if ( auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attr ) )
|
||||
{
|
||||
doubleAttr->setFixedWithTwoDecimals();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
int m_decimals;
|
||||
NumberFormat m_numberFormat;
|
||||
|
Loading…
Reference in New Issue
Block a user