@@ -19,21 +19,24 @@ USE_ENCODING_AUTODETECTION
1919
2020QtDoubleTextField::QtDoubleTextField (QWidget* parent, bool autoValidation, const char * name)
2121 : QtValidatedTextField (parent, autoValidation, name)
22+ , _keepIosBaseDefault(false )
2223{
2324 createGui ( );
2425} // QtDoubleTextField::QtDoubleTextField
2526
2627
2728QtDoubleTextField::QtDoubleTextField (double value, QWidget* parent, bool autoValidation, const char * name)
2829 : QtValidatedTextField (parent, autoValidation, name)
30+ , _keepIosBaseDefault(false )
2931{
3032 createGui ( );
3133 setValue (value);
3234} // QtDoubleTextField::QtDoubleTextField
3335
3436
35- QtDoubleTextField::QtDoubleTextField (const QtDoubleTextField&)
37+ QtDoubleTextField::QtDoubleTextField (const QtDoubleTextField& field )
3638 : QtValidatedTextField (0 , 0 )
39+ , _keepIosBaseDefault(field._keepIosBaseDefault)
3740{
3841 assert (0 && " QtDoubleTextField::QtDoubleTextField is not allowed." );
3942} // QtDoubleTextField::QtDoubleTextField (const QtDoubleTextField&)
@@ -102,10 +105,17 @@ void QtDoubleTextField::setValue (double value)
102105 } // if ((value < validator.bottom ( )) || (value > validator.top ( )))
103106
104107 // On évite de perdre des epsilons avec le format d'affichage par défaut des streams c++ :
105- UTF8String us;
106- us << (QDoubleValidator::StandardNotation == getNotation ( ) ? ios_base::fixed : ios_base::scientific);
107- us << IN_UTIL setprecision (validator.decimals ( )) << value;
108- setText (UTF8TOQSTRING (us));
108+ if (_keepIosBaseDefault)
109+ {
110+ setText (QString::number (value));
111+ }
112+ else
113+ {
114+ UTF8String us;
115+ us << (QDoubleValidator::StandardNotation == getNotation ( ) ? ios_base::fixed : ios_base::scientific);
116+ us << IN_UTIL setprecision (validator.decimals ( )) << value;
117+ setText (UTF8TOQSTRING (us));
118+ }
109119 getValue ( );
110120} // QtDoubleTextField::setValue
111121
@@ -156,8 +166,9 @@ QDoubleValidator::Notation QtDoubleTextField::getNotation ( ) const
156166} // QtDoubleTextField::getNotation
157167
158168
159- void QtDoubleTextField::setNotation (QDoubleValidator::Notation notation)
169+ void QtDoubleTextField::setNotation (QDoubleValidator::Notation notation, bool keepIosBaseDefault )
160170{
171+ _keepIosBaseDefault = keepIosBaseDefault;
161172 const QDoubleValidator& old = getValidator ( );
162173 if (notation == old.notation ( ))
163174 return ;
0 commit comments