1. Before you select some text, store the current cursor state:
Qt Code:
  1. QTextCursor cr = textEdit->textCursor();
To copy to clipboard, switch view to plain text mode 
2. Select your text using movePosition and all that stuff. Do something with the selected text;
3. Restore the saved cursor state:
Qt Code:
  1. textEdit->setTextCursor (cr);
To copy to clipboard, switch view to plain text mode