[PyQt] QDoubleValidator

Adam Tenderholt atenderholt at gmail.com
Fri Jul 13 18:43:42 BST 2007

Have you tried creating the validator first with edit as the last
arguement instead of self:

validator = QDoubleValidator(0.0, 1.0, 9, edit)


On 7/13/07, Katja Wegner <k.wegner at herts.ac.uk> wrote:
> Hello,
> 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,
> katja
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list