Important: Please read the Qt Code of Conduct -

Trouble with QValidator and editingFinished()

  • Hey,

    I got a QLineEdit Field connected with a editingFinished() signal. It should do an action when the QLineEdit field is empty. Thats works fine. But now i would like add a QValidator to the filed, like this:
    v = new QIntValidator(0, 999, this);

    Now the problem is, when the field goes empty the editingFinished() won't called. Is there any way to do this with a QValidator?

  • Hey, try this
    @field->setValidator(new QRegExpValidator(QRegExp("\d{0,3}")));@

  • Yes that works perfectly. Thank you! :)

Log in to reply