[Solved]QDoubleValidator: How to reject comma as decimal point?
-
Hi,
in my application I want to avoid that numbers are entered with a comma as decimal point.
code for the validator:
@
QDoubleValidator v;
QLocale loc=QLocale::c();
loc.setNumberOptions(QLocale::RejectGroupSeparator | QLocale::OmitGroupSeparator);
v.setLocale(loc);
@The problem is that the validator accepts both "1.23" and "1,23".
Am I doing sth wrong or might this be a bug in Qt?
I'm using Qt 4.8.4.
-
I know that is a late answer, but will be usefull for someone with the same need.
i resolve with QRegExpValidator
@
lineEdit->setValidator(new QRegExpValidator(QRegExp("[-]{0,1}\d{0,}\.\d{0,}"),0) );
@
it work for me, only accept one dot.