You're welcome. If you just want the text use QString::trimmed():
Qt Code:
  1. text = cursor->selectedText().trimmed();
To copy to clipboard, switch view to plain text mode