I want to make a pop-up tool that gets the character from under the mouse cursor and a number of consequent characters. I want to use them to display the translation of this word/phrase using a dictionary. Hopefully I want to be able to parse everything in a Qt application, but if it's not possible, parsing text in WebKit would be enough.

I googled and asked on IRC, and the only thing i've got is that someone recommends using the accessibility interface, but i just don't know which part of it I can apply. The other ways include marking each character in the WebKint and using Javascript to invoke events.

So, is there a clean and tidy method of retrieving text from under the mouse cursor? Thanks in advance.