[Qt-interest] How to create a KeyEvent when I click the mouse?
Nathan Carter
nathancarter5 at gmail.com
Mon Jul 6 15:46:49 CEST 2009
Dear Kermit,
Here's a Qt example of how to create an event and send it through the
event loop.
http://qt.gitorious.org/qt-labs/graphics-dojo/blobs/master/htmleditor/htmleditor.cpp#line178
That's a mouse event, not a key event, but it's the general idea.
I've imitated the above code in one of my own apps. Of course, you'll
also want to know about the constructors for QKeyEvent, and they're
documented in the usual place.
http://doc.qtsoftware.com/4.5/qkeyevent.html#QKeyEvent
Let us know if it doesn't work.
Nathan
On Jul 6, 2009, at 6:15 AM, Kermit Mei wrote:
> Hello, all!
> I'm implementing a virtual Keyboard which will run on ARM. Now, I hope
> when I click the button, the corresponding key board event will be
> emit,
> as if it is a real key event.
>
> For example, When I click the "Home" button, the widget's
> QWidget::KeyPressEvent() and QWidget::KeyReleaseEvent() will work as
> if
> a real "Home" key was pressed.
>
> How can I implement it ?
>
> Thanks.
>
> Kermit
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list