QDoubleValidator is not working?

c++, qt, qvalidator, validation

Solution

Just tripped over this one. Try setting the QDoubleValidator notation to:

doubleValidator->setNotation(QDoubleValidator::StandardNotation);

Problem

I'm trying to apply validator in a line edit box in Qt 4.2 and it is not working: ``` QDoubleValidator *haha= new QDoubleValidator(this); haha->setBottom(0.00); haha->setDecimals(2); haha->setTop(100.00); get_line_edit()->setValidator(haha); ``` or ``` QDoubleValidator *haha= new QDoubleValidator(0.00,100.00,2,this); ``` Neither way, I can still enter what ever value I want. But if I switch to `QIntValidator`, it works! So I went onto Google and did a bit search, and many people used to having the same issue. Is it a bug? or there should be some other set up I should do?

Original source