You will need to start looking into QTextDocument for advanced text manipulation.

Cheers,
_