[Qt-interest] stalled or blocked key events. [ ref:00D26XEw.50027uXcv:ref ]
slheitz at rockwellcollins.com
slheitz at rockwellcollins.com
Fri Nov 20 15:04:21 CET 2009
How is Qt receiving and handling the keyboard event prior to my native
keyboard handler.
Qt does not receive an event until I call processkeyevent.
What do you mean be one or the other event handling systems?
In your docementation for creating custom keyboard handler/plugins it says
to use qsocketnotifier, and in the example code and drivers that are being
used by qt seem to be using this method.
We are running embedded qt on Linux, version 4.5.2
"\"Nokia Support\" <support at qt.nokia.com>"
Sent by: no-reply at salesforce.com
11/20/2009 06:14 AM
To
"slheitz at rockwellcollins.com" <slheitz at rockwellcollins.com>
cc
Subject
RE: stalled or blocked key events. [ ref:00D26XEw.50027uXcv:ref ]
Hi Sean,
> I have written a keyboarddriver plugin.
>
> I have am using Qsocketnotifier to signal me when the keyboard character
> device has been updated.
>
> keypadhandler
> {
> KeypadFD = open("/dev/mydevice", O_RDONLY | O_NONBLOCK, 0);
>
> Notify = new QSocketNotifier(KeypadFD, QSocketNotifier::Read, this);
> connect(Notify, SIGNAL(activated(int)), this, SLOT(ReadKeypadData()));
>
> }
>
>
>
> Then my readdata file runs off of the qsockettnotifiersignal.
>
> ReadKeypadData
> {
> uint n = read(KeypadFD, KeyPress1, sizeof(KeyPress1));
>
>
> then I determine what key it is and translate it to a Qt key event and
call
> process keyevent.
>
> processKeyEvent(EXTENDED_UNICODE, qtkey, Qt::NoModifier, true, false);
>
> }
>
>
>
> My issue is that when I hit a key the first time it runs through the
readdata
> function and I see that it executes and runs processkeyevent. But no
key
> event shows up in my running server app. Then when I hit the key agian
I see
> that it
> runs through the readdata function and I see that it processes the
previous
> key and the current one. So the first key is always getting held up
until I
> hit another key then it gets sent along with the second key.
>
> Any Ideas?
Qt is receiving and handling the keyboard event prior to your the native
keyboard handler that you have set up. It's advisable to use one event
handling system or the other but not both, since you cannot guarantee that
events handling will behave predictably.
You can mitigate for this by either reimplementing winEventFilter() on
QCoreApplication:
http://doc.trolltech.com/4.5/qcoreapplication.html#winEventFilter
or by installing an event filter on the event dispatcher, using the static
call QAbstractEventDispatcher::instance() to return an instance of the
dispatcher.
http://doc.trolltech.com/4.5/qabstracteventdispatcher.html#instance
Which method is most suitable depends on the rest of your application.
Let me know if you have further questions.
Regards,
Matthew
--
Matthew Cattell,
Support Engineer
Qt Development Frameworks, Nokia
ref:00D26XEw.50027uXcv:ref
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091120/3f7000f3/attachment.html
More information about the Qt-interest-old
mailing list