[PyQt] QDoubleValidator

Katja Wegner k.wegner at herts.ac.uk
Fri Jul 13 18:13:27 BST 2007

I use PyQt 4.2.1 under Linux and 4.2.2 under Windwos. The 
QDoubleValidator does not work. I set a range of 0.0 to 1.0 but the user 
can still enter what ever he wants in a QLineEdit and  even negative 
values. Did anybody experience the same or know how to solve it (except 
writing my own)? The funny thing is that some line edits allow negative 
values and some don't, although they are all created with the same method:

edit.setValidator(QDoubleValidator(0.0, 1.0, 9, self))

I also checkd the validator of each line edit (edit.validator()) and the 
values are correct but it doesn't work.

Thanks a lot,

More information about the PyQt mailing list