[Qt-interest] QDoubleValidator doesn't work on limits?
Davor J.
DavorJ at live.com
Tue Jun 1 14:21:10 CEST 2010
Yes... very stupid of me. Should have read that.
Thanks Constantin.
Davor
"Constantin Makshin" <cmakshin at gmail.com> wrote in message
news:201006011556.11611.cmakshin at gmail.com...
> The documentation on QDoubleValidator::validate() function states that "If
> notation() is ScientificNotation, and the input is not in the valid range,
> Intermediate is returned. The value may yet become valid by changing the
> exponent."
> So, in your case, when the exponent becomes too large, the number is still
> treated as "more or less acceptable" in the hope the user will "fix" it.
>
> On Tuesday 01 June 2010 12:03:49 Davor J. wrote:
>> 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