Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.2.1
-
None
-
Windows
Description
I'm working on a French Windows 7 computer.
When I try to type a decimal number in a QDoubleSpinBox control or a QLineEdit validated by a QDoubleValidator, pressing the dot numeric keypad button does nothing....I would expect it to insert a decimal separator!
Like Microsoft Excel does: if I press "1" "." and "2" from the numeric keypad, is writes "1,2" in the selected cell (because "," is the decimal separator on my machine).
I attached a main.cpp as an example.
#include <QApplication> #include <QVBoxLayout> #include <QLabel> #include <QSpinBox> #include <QDialog> #include <QDoubleValidator> #include <QLineEdit> class Dialog : public QDialog { public: Dialog() { QVBoxLayout* layout = new QVBoxLayout( this ); layout->addWidget( new QLabel( QLocale().toString( 3.14 ), this ) ); layout->addWidget( new QDoubleSpinBox( this ) ); QLineEdit* edit = new QLineEdit( this ); edit->setValidator( new QDoubleValidator() ); layout->addWidget( edit ); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog w; w.show(); return a.exec(); }
When compiled and executed, here's what I see:
- The QLabel displays "3,14" which means french QLocale is correctly used (else, it would display 3.14, english default stype). OK
- The QDoubleSpinBox diplays "0,00". OK
- I can type a decimal value in the spinbox using the ',' standard keyboard key. OK
- I cannot type a decimal value in the spinbox using the '.' standard keyboard key. OK
- But when I press the dot key from my numerical French keypad, nothing happens! This is supposed to enter a decimal separator, whatever locale setting is being used!
Note: Qt 4.7 used to work fine displaying and using "." as a separator, Qt 5.2 appears to be smart enough to automatically change "." to "," on my PC, but not smart enough to make the keypad "." key work