PDA

View Full Version : Text to system (faking keyboard input)



strahlex
15th April 2012, 09:41
Hello developers,

I try to send a simple unicode text to a remote machine, and there I it should be output like it was typed in with the keyboard. I know this is maybe not possible with Qt. Have you any ideas how to solve that problem (I thought about mapping the unicode characters back to scan codes)? Or do you know some applications that do something like this (where I can read how they did it).

Strahlex

Spitfire
16th April 2012, 11:52
I'm assuming that there's some app on the client machine running and you want those keys to be triggered in that app.
If that's the case then look at postEvent() (http://doc.qt.nokia.com/4.7-snapshot/qcoreapplication.html#postEvent).
Using postEvent() you can send QKeyEvent (http://doc.qt.nokia.com/4.7-snapshot/qkeyevent.html) and the app will behave as someone would press a key on the keyboard.

Not sure why you would waht to do that though.