Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.4.1
-
None
-
b81b8e43ad57183ed66086ec90cabef5906ab9a2
Description
QIntValidator's have a setLocal() method to set the Locale for the validator. When setting this validator to a QLineEdit and then calling setText(locale.toString(1234)) on the QLineEdit an int with a comma in it is set. This though is not a valid integer even with the Locale set. This should not be the case.
What is the purpose of setting a locale for QIntValidator if it's not going to respect the locale.
Example:
#include <QApplication> #include <QDialog> #include <QLineEdit> #include <QIntValidator> #include <QVBoxLayout> int main(int argc, char *argv[]) { QApplication app(argc, argv); QDialog dialog; QLineEdit* pLineEdit1 = new QLineEdit("", &dialog); QVBoxLayout* vBox = new QVBoxLayout; vBox->addWidget(pLineEdit1); dialog.setLayout(vBox); QLocale loc; QIntValidator* pValidator = new QIntValidator(pLineEdit1); pValidator->setLocale(loc); pLineEdit1->setValidator(pValidator); int n = 1234; pLineEdit1->setText(loc.toString(n)); return dialog.exec(); }