PDA

View Full Version : insertPlainText and carriage return



RenanBS
28th August 2012, 17:32
term is a class that descends from QPlainTextEdit.

This is my code:


QByteArray ba = "Test123\r";
term->insertPlainText(ba);
term->insertPlainText("ABC");


I was expecting that the result of this code was like this:

ABCTest123
or

ABCt123
ABC should be in the same line that Teste123 was.
But the result is

Test123
ABC

Just want the carriage return to return the carriage in the same line.
Is it possible or do I have to treat this kind of thing manually?

Thanks is advance

spirit
28th August 2012, 17:51
You have to remove \r before inserting.

RenanBS
28th August 2012, 18:33
So, if I want to treat this behavior, I have to do it manually?

Thanks

spirit
28th August 2012, 18:41
Yes. You can use QByteArray::simplified, QByteArray::replace, QString::simplified, QString::replace.