I have a QTextEdit that contains a carriage return.
I convert to QString :
Message = qMessage->toPlainText();
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
for ( int i = 0; i < Message.size(); i++ )
if ( ( Message
[i
] == QChar(10) ) && ( Message
[i
+1] == QChar(13) ) ) { Message[i] = ' ';
Message[i+1] = ' ';
}
for ( int i = 0; i < Message.size(); i++ )
if ( ( Message[i] == QChar(10) ) && ( Message[i+1] == QChar(13) ) ) {
Message[i] = ' ';
Message[i+1] = ' ';
}
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.
Bookmarks