So I rewrote it all again in Perl, because the next step (the predictive text input) will be much easier with regular expressions. (although, there is a QRegExp class that mimics Perl regexps... but why?)
I'll probably run into problems again and switch back to C++. We'll see.
Actually, I'll probably prototype it in Perl, then go back to C++ once I like it. That way I can just make the IR listener run in a separate thread.