[Qt-interest] QDoubleValidator doesn't work on limits?

Davor J. DavorJ at live.com
Tue Jun 1 10:03:49 CEST 2010


Can someone explain what is wrong with the following code using Qt4.6.2?

#include <QtGui>
#include <limits>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    typedef std::numeric_limits<double> dLimit;
    QLineEdit *factorEdit = new QLineEdit();
    factorEdit->setValidator(new QDoubleValidator(-dLimit::max(), 
dLimit::max(), 5, factorEdit));
    factorEdit->show();
    return a.exec();
}

I can type "10e1815212121211818" and the validator approves it, although the 
limit is approx 10e308?

Regards,
Davor







More information about the Qt-interest-old mailing list