In KWord1 we had the concept of text-runaround. This is basically the ability of KWord to detect there are other objects on the page and to make sure the text is not printed on top of other content.
In a casual conversation I noted this problem to Zack Rusin, who within 5 minutes gave me the solution on how to attack this problem! He even gave some example code that he typed in his irc command line :)
Thanks fly to Zack for being cool (among other things), and also to Qt4 for making hard stuff a whole lot easier.
Now; for those that are curious on how I did this; here is a test app; runaround_paths.cpp.