[PyQt] QDoubleValidate and Locale

Nick Gaens nickgaens at gmail.com
Thu Nov 25 21:07:19 GMT 2010


I don't understand what your question is, exactly.

You say that when using the English ("en") locale, a decimal "." is accepted
as input (as it should), but when using the Spanish ("es") locale, the comma
is also accepted as a decimal separator.

I'm not Spanish so I cannot verify the following, but I can imagine that
this is regular behaviour IF Spanish grammar allows you to write a comma in
decimal numbers :-P.

Anyway: a simple fix for not having to worry about this could be this:

enteredValue = yourLineEdit.text().replace(',', '.').toDouble()



Wkr,


2010/11/25 Juan José Gómez Romera <jjgomera at gmail.com>

> Hi, im using QDoubleValidate to check the imput in a QLineEdit, work great
> with en locale, only let write number and a point for decimals, but with es
> locale the QDoubleValidate let write also ",",so i have to add other imput
> check in code to avoid that.
> Im look for in QDoubleValidate documentation any reference to milliar comma
> or similar, but i dont find nothing to solve it, is this a bug or is normal?
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Nick Gaens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101125/6d94f354/attachment.html>


More information about the PyQt mailing list