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

QPlainTextEdit How to de-select all?



  • I am attempting to learn Qt on Ubuntu and C++ and have been using the Terminal example. I've been able to selectAll() and copy() the selected text but don't see how to deselect it after I've copied it. I've not found any reference in my Google and Qt forum searches.

    How is this done?


  • Lifetime Qt Champion

    hi
    try this
    QTextCursor cursor = ui->textEdit->textCursor();
    cursor.movePosition( QTextCursor::End );
    ui->textEdit->setTextCursor( cursor );

    ui->textEdit should of course be changed to the real name in your app.



  • Thanks, worked as expected!