Reputation: 109
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?
Upvotes: 1
Views: 1813
Reputation: 28111
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.
Upvotes: 2