It does exactly what you are asking for. QLineEdit::paste()If all the text in the line edit is selected then paste() replaces all the text. If no text in the line edit is selected then paste() inserts the text. See alsoInserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only.
QLineEdit::deselect(), QLineEdit::selectAll(), QLineEdit::setCursorPosition() etc.
Bookmarks