How to move the caret to the end of the text in QTextEdit? Code example:
void MainWindow::on_mark_textChanged() { if((ui->mark->toPlainText()).size() > 2) { QString str = ui->mark->toPlainText(); str.chop(1); ui->mark->setText(str); } }
Here the input text is truncated to two characters, and the carriage returns to the beginning.