mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
Removes QIntValidator and uses setRange
Replaces the usage of `QIntValidator` with the `setRange` function available in the PDM framework for limiting integer input in UI fields. This approach provides a more direct and maintainable way to specify value ranges for UI elements. This change simplifies the code and reduces dependencies.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellPathCompletionSettings.h"
|
||||
|
||||
#include "RiaStdStringTools.h"
|
||||
@@ -101,6 +102,8 @@ RimWellPathCompletionSettings::RimWellPathCompletionSettings()
|
||||
"WellBoreFluidPvtTable",
|
||||
0,
|
||||
"Wellbore Fluid PVT table" );
|
||||
m_wellBoreFluidPVTTable.setMinValue( 0 );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density" );
|
||||
CAF_PDM_InitScriptableField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region" );
|
||||
|
||||
@@ -409,28 +412,6 @@ void RimWellPathCompletionSettings::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
m_mswParameters->fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCompletionSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute );
|
||||
if ( field == &m_wellBoreFluidPVTTable && lineEditorAttr )
|
||||
{
|
||||
// Positive integer
|
||||
QIntValidator* validator = new QIntValidator( 0, std::numeric_limits<int>::max(), nullptr );
|
||||
lineEditorAttr->validator = validator;
|
||||
}
|
||||
else if ( field == &m_fluidInPlaceRegion && lineEditorAttr )
|
||||
{
|
||||
// Any integer
|
||||
QIntValidator* validator = new QIntValidator( -std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), nullptr );
|
||||
lineEditorAttr->validator = validator;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user