1

I have a problem with displaying a text to area with different attributes.

My project has a multi-threading build. I reach to GUI text area by using signal-slot mechanism. I put my texts to the text area like this;

addrMW->ui->printerArea->appendPlainText(command.Data);

I want to append my text to this area with different font, size, etc..

I'm using Qt Creator 2.7.2 / Qt 5.1. Could someone explain this to me with an example?

huysentruitw
  • 27,376
  • 9
  • 90
  • 133
srdrgkcn89
  • 109
  • 1
  • 11

1 Answers1

2

What you want is a rich text edit. Luckily QTextEdit is able to handle that. Check the acceptRichText property (which should be true by default).

Then the methods you're looking for are:

Then, instead of appendPlainText() you should use append() to add text to the QTextEdit. Also see this Q/A. As proposed in the accepted answer, you can also use html formatted text instead.

Community
  • 1
  • 1
huysentruitw
  • 27,376
  • 9
  • 90
  • 133
  • Thank you for your advices and solutions, i found my answer in [here](http://stackoverflow.com/questions/2857864/qtextedit-with-different-text-colors-qt-c) – srdrgkcn89 Aug 26 '13 at 10:58
  • @srdrgkcn89 I thought so, that's why I added a link to that question in my answer. – huysentruitw Aug 26 '13 at 11:00