c++ - QDoubleValidator accepts multiple decimal points -
i'm using qdoublevalidator
qlineedit
. application locale (set in qtcreator) qlocale::german
.
now when come in valid double (either using dot or comma decimal separator) writing textedit converting string float works fine. validator lets me write stuff multiple decimal separators. strings 123.567,890
or ,,03.4...
validated can't converted float.
is there way tell qdoublevalidator
validate real numbers , not strings without alphabetical characters?
i want have validator, validates strings, can converted floats using either default locale or high german locale.
i have not used qdoublevalidator
far accomplish such behaviour using qregexpvalidator
:
qregexpvalidator* rxv = new qregexpvalidator(qregexp("[+-]?\\d*[\\.,]?\\d+"), this); lineedit->setvalidator(rxv);
c++ qt qt5 qlineedit qvalidator
No comments:
Post a Comment