Reputation: 530
I don't want to validate the double
Value Using QLineEdit
, I want to validate it from the code itself, so I tried :
QDoubleValidator dv(1.5,30.0,1);
double d = 1.3;
int pos=0;
qDebug()<< dv.validate(QString::number(d,'f',1), pos);
This Above qDebug()
should return QValidator::Invalid i.e. 0
,
But it is returning QValidator::Intermediate
i.e. 1 always
for every double value ?
Upvotes: 2
Views: 1370
Reputation: 21220
According to the Qt source code, it will return QValidator::Invalid
only if:
It will return QValidator::Acceptable
only if input string represents a valid double value (excluding mentioned above) that falls between bottom and top values.
All the rest cases the function returns QValidator::Intermediate
.
Upvotes: 3