I have a QTextEdit that contains a carriage return.
I convert to QString :
Qt Code:
  1. Message = qMessage->toPlainText();
To copy to clipboard, switch view to plain text mode 
Then I am unable to remove the carriage return from the QString and replace it with a space character.

I tried :
- to split the string with regexp "\r"
- the stupid
Qt Code:
  1. for ( int i = 0; i < Message.size(); i++ )
  2. if ( ( Message[i] == QChar(10) ) && ( Message[i+1] == QChar(13) ) ) {
  3. Message[i] = ' ';
  4. Message[i+1] = ' ';
  5. }
To copy to clipboard, switch view to plain text mode 
- Message.replace("\r"," ");
- Message.replace(QRegExp("\r"), " "); even with "0x0D"

All fails.

At the end of the modification I copy back my QString to a QTextEdit to display the result and the carriage return is still there. No way to remove it.