tags:

views:

46

answers:

1

Hi,

I am using a QTextEdit in my C++ GUI application, I use textEdit->append(byteArray); to add some text, unfortunately append() adds a new line character at the end that I would like to remove after each call of append(). I know I could use insertPlainText() which does not add a new line character but it uses a lot more memory when dealing with big documents.

Thanks for your help!

+3  A: 

Since the documentation for QTextEdit::insertPlainText says

It is equivalent to

edit->textCursor().insertText(text);

I would assume that you can just do something like

edit->textCursor().deletePreviousChar();

If you need to you can first clear any selection with

edit->textCursor().clearSelection();
Troubadour
Thanks, a lot! Sorry for my question, seems to easy, but I could not find a solution ...
walki
@user363778: Hey, no problem. Glad to help!
Troubadour