Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTextEdit and setValidator



  • Hi,

    I want a QTextEdit to prevent certain characters form being entered by the user. I tried what I did with a few QLineEdits but QTextEdit dosen't have setValidator()

    ui->NotesTEdit->setValidator(new QRegExpValidator(rx, ui->NotesTEdit));
    

    error: 'class QTextEdit' has no member named 'setValidator'

    how can I get the intended behavior?


  • Lifetime Qt Champion

    Hi,

    That's something you'll have to implement by hand. Likely using the textChanged.

    Hope it helps


Log in to reply