Important: Please read the Qt Code of Conduct -

QDoubleValidator don´t fix comma and point

  • I am dealing with validation, need to validate a form
    wit integer and doubles.
    put a integer validator, i not need ranges:

    intlineEdit->setValidator(new QIntValidator());
    if a write this number:
    Wen it lost the focus, fix the content to:
    that behaviour is nice.

    But in other widget need to validate double with no ranges
    doublelineEdit->setValidator(new QDoubleValidator());
    if a write:
    when it lost the focus Nothing Hapen!!.

    i dont set InputMask
    How can fix it, i want the same bahaviour like integervalidator.

  • Reading from de docs, QIntValidator has a fixup() function which does fix the contents as you describe. QDoubleValidator however does not provide a fixup() function. So if you would like the same behaviour as QIntValidator, then create your own by subclassing QValidator.

Log in to reply