QPainter is just the low level drawing API, QTextEdit ultimately uses it to draw its content.
The QTextEdit widgets is a pretty versatile component due the text layout engine it uses.
This engine is QTextDocument. See QTextEdit::document().
It allows you to manipulate text very similar to a text processor, e.g. having different formats for different sections of text.
One of the involved classes, QTextCharFormat, allows to set the pen used to draw text outline. See QTextCharFormat::setTextOutline().
I haven't used this particular feature myself yet, but this could be what you are looking for.
Cheers,
_
Bookmarks