: QDoubleSpinBox( parent ),
myCleared( false )
{
+ // VSR 01/07/2010: Disable thousands separator for spin box
+ // (to avoid incosistency of double-2-string and string-2-double conversion)
+ QLocale loc;
+ loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ setLocale(loc);
+
// Use precision equal to default Qt decimals
myPrecision = decimals();
: QDoubleSpinBox( parent ),
myCleared( false )
{
+ // VSR 01/07/2010: Disable thousands separator for spin box
+ // (to avoid incosistency of double-2-string and string-2-double conversion)
+ QLocale loc;
+ loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ setLocale(loc);
+
// Use precision equal to default Qt decimals
myPrecision = decimals();
myCleared( false ),
myPrecision( prec )
{
+ // VSR 01/07/2010: Disable thousands separator for spin box
+ // (to avoid incosistency of double-2-string and string-2-double conversion)
+ QLocale loc;
+ loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ setLocale(loc);
+
setDecimals( dec );
setMinimum( min );
setMaximum( max );
*/
QString QtxDoubleSpinBox::textFromValue( double val ) const
{
- QString s = QLocale().toString( val, myPrecision >= 0 ? 'f' : 'g', qAbs( myPrecision ) );
+ QString s = locale().toString( val, myPrecision >= 0 ? 'f' : 'g', qAbs( myPrecision ) );
return removeTrailingZeroes( s );
}
*/
QString QtxDoubleSpinBox::removeTrailingZeroes( const QString& src ) const
{
- QString delim( QLocale().decimalPoint() );
+ QString delim( locale().decimalPoint() );
int idx = src.lastIndexOf( delim );
if ( idx == -1 )
v.setNotation( myPrecision >= 0 ? QDoubleValidator::StandardNotation :
QDoubleValidator::ScientificNotation );
- if ( overhead == 0 )
+ if ( overhead == 0 ) {
state = v.validate( str, pos );
+ }
else
{
if ( str.length() >= overhead && str.startsWith( pref ) &&
}
else if ( myPrecision < 0 ){
// Consider too large negative exponent as Invalid
- QChar e( QLocale().exponential() );
+ QChar e( locale().exponential() );
int epos = str.indexOf( e, 0, Qt::CaseInsensitive );
if ( epos != -1 ){
epos++; // Skip exponential symbol itself
: QSpinBox( parent ),
myCleared( false )
{
+ // VSR 01/07/2010: Disable thousands separator for spin box
+ // (to avoid incosistency of double-2-string and string-2-double conversion)
+ QLocale loc;
+ loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ setLocale(loc);
+
setCorrectionMode( QSpinBox::CorrectToNearestValue );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
this, SLOT( onTextChanged( const QString& ) ) );
: QSpinBox( parent ),
myCleared( false )
{
+ // VSR 01/07/2010: Disable thousands separator for spin box
+ // (to avoid incosistency of double-2-string and string-2-double conversion)
+ QLocale loc;
+ loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ setLocale(loc);
+
setMinimum( min );
setMaximum( max );
setSingleStep( step );