Evans Belloeil
Evans Belloeil

Reputation: 2503

Generate a keyPressEvent/Input

I need to generate an input of my keyboard, because I have an event attached to it. I tried to call this but without success:

keyPressEvent(Qt::Key_Delete);

Is there a way to generate this keyPressEvent ?

Upvotes: 0

Views: 355

Answers (1)

j809
j809

Reputation: 1499

You might like to use a QkeyEvent.

Are you using Qt4 or Qt5?

Have a look at this:

https://stackoverflow.com/a/2035547/3751213

It might help.

Or, if you are using linux then xte would be great. It is included in xautomation.

xte 'key Delete'

Look here: http://linux.die.net/man/1/xte

Upvotes: 1

Related Questions