Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.4, 4.8.5, 4.8.6, 5.4.0 Beta
-
Ubuntu 12.04
-
94e40c7c7874a2bceb9d6f01947c1668fd92f559 (qtbase/5.4, 20.11.2014, 5.4.1)
Description
Please check the code bellow!
The expected result it should be, that is invalid instead of acceptable.
The documentation of 5.x doesn't contain: "QDoubleValidator will not accept numbers with thousand-separators." anymore.
#include <QString> #include <QLocale> #include <QApplication> #include <QDoubleValidator> #include <QDebug> int main( int argc, char* argv[] ) { QApplication a( argc, argv ); QString input = "1.000.000,50"; int pos = input.length()-1; QObject o; // dummy QDoubleValidator v( &o ); QLocale loc(QLocale::German,QLocale::Germany); //loc.setNumberOptions(QLocale::RejectGroupSeparator); v.setLocale(loc); qDebug()<<"Decimal :"<<v.locale().decimalPoint(); qDebug()<<"Group separator :"<<v.locale().groupSeparator(); QValidator::State s = v.validate( input, pos ); qDebug()<< "Validator result: "; switch ( s ) { case QValidator::Invalid: qDebug()<<"Invalid"; break; case QValidator::Intermediate: qDebug()<<"Intermediate"; break; case QValidator::Acceptable: qDebug()<<"Acceptable"; break; } return 0; }
Attachments
For Gerrit Dashboard: QTBUG-42522 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
100090,2 | Observe QLocale::RejectGroupSeparator in QInt/DoubleValidator. | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |
100215,3 | Add a note about group separators to numeric validators. | 5.4 | qt/qtbase | Status: MERGED | +2 | 0 |