Issue with the QDoubleValidator
-
Hi Everyone,
I am validating the line edit in the qt. Below is the code for it.
ui->lineEdit_1->setValidator(new QDoubleValidator(0, 10000.0, 2));I am using the double validator for validating the lineEdit_1 field.
But In the GUI it is taking character "e".
But not all the alphabets, it takes only character "e".
May be it is considering as exponential "e" I am not understanding.Please let me know how to get rid off this.
Suggestions are appreciated.
Thank you.
-
Hi Everyone,
I am validating the line edit in the qt. Below is the code for it.
ui->lineEdit_1->setValidator(new QDoubleValidator(0, 10000.0, 2));I am using the double validator for validating the lineEdit_1 field.
But In the GUI it is taking character "e".
But not all the alphabets, it takes only character "e".
May be it is considering as exponential "e" I am not understanding.Please let me know how to get rid off this.
Suggestions are appreciated.
Thank you.
@Shruthi
Yes, theecharacter is for "scientific notation" (with an exponent, representing10 ^ number_after_e).
See https://doc.qt.io/qt-5/qdoublevalidator.html#notation-prop, you want to trysetNotation(QDoubleValidator::StandardNotation)on your validator.