Hey hey, just saying!
Maybe you haven't heard of it. KDE uses DCOP (Desktop Communications Protocol) to allow applications to communicate. Correcting my previous statement, DCOP is used by KDE, not Qt, although they are related. Ever wondered how you can have an applet on a panel to control your music player? Run kdcop and check out what you can do. You will likely see a play method amond other things. Open a few text editors, examine them in kdcop, and notice how easy it would be to do what the OP is asking.
http://www.kdedevelopers.org/taxonomy/term/30
http://developer.kde.org/documentation/other/dcop.html