Does QFontMetrics handle rich text strings? It doesn't really say so in the docs, but it might be worth checking out.