When consulting for Hyves, we wanted a light-weight widget that displays html and animated gifs (for smileys) for the chat client and for tooltips. The option to use Qt/WebKit was out since we intended to create numerous instances of this widget (it consumed lots of memory) and the rendering was not as fast we would like. QLabel does not support animated gifs, so that was not an option either.
Instead of writing a basic html parser, layouter and renderer, I thought I can somehow trick QTextDocument into displaying animated gifs. You can see the basic idea in this kb but to get it working with animations wasn’t easy. One good thing about adding the feature to QTextDocument is that you can set it on QTextBrowser and QTextEdit.
Without further ado, get the code here. Label is a richtext label that does not support links or selection. TextBrowser is a browser that supports selection and links. TextEdit is an editor with support for undo/redo.
P.S. Thanks to Hyves for making it possible to actually publish this code; they released most of their code as GPL.