mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5220 Support setting double number format in the caf::PdmUiDoubleValueEditor
This commit is contained in:
parent
7ac13b3868
commit
7391c7acfe
@ -85,7 +85,12 @@ void PdmUiDoubleValueEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
QString textValue;
|
||||
if (valueOk)
|
||||
{
|
||||
textValue = QString::number(value, 'g', m_attributes.m_decimals);
|
||||
if (m_attributes.m_numberFormat == PdmUiDoubleValueEditorAttribute::NumberFormat::FIXED)
|
||||
textValue = QString::number(value, 'f', m_attributes.m_decimals);
|
||||
else if (m_attributes.m_numberFormat == PdmUiDoubleValueEditorAttribute::NumberFormat::SCIENTIFIC)
|
||||
textValue = QString::number(value, 'e', m_attributes.m_decimals);
|
||||
else
|
||||
textValue = QString::number(value, 'g', m_attributes.m_decimals);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,13 +53,21 @@ namespace caf
|
||||
class PdmUiDoubleValueEditorAttribute : public PdmUiEditorAttribute
|
||||
{
|
||||
public:
|
||||
enum class NumberFormat
|
||||
{
|
||||
FIXED,
|
||||
SCIENTIFIC,
|
||||
AUTOMATIC
|
||||
};
|
||||
PdmUiDoubleValueEditorAttribute()
|
||||
{
|
||||
m_decimals = 6;
|
||||
m_numberFormat = NumberFormat::AUTOMATIC;
|
||||
}
|
||||
|
||||
public:
|
||||
int m_decimals;
|
||||
int m_decimals;
|
||||
NumberFormat m_numberFormat;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user