Get the timestamp when a QInputEvent was put onto the queue of the QEventLoop in Qt 4.8

故事扮演 提交于 2019-12-31 05:40:23

问题


This question is closely related to QEventLoop: get time when an event was scheduled. Here I'm asking specifically about input events in contrast to "all kinds of events". I'm also interested in a solution for Qt 4.8.

For QInputEvent in Qt 5 there is a timestamp() member method that can be used. In Qt 4.8 there is no such method. Are there any other approaches to get the timestamp when an input event was initially "emitted" by driver/deeper systems. Or when it was initially "received" by Qt and put onto the event queue?


回答1:


I took a look into the different keyboard/input drivers in embedded Qt and found that there is no handling of timestamps whatsoever. So the available default implementations where not satisfying.

I managed to get the timestamps by implementing my own logic on my specific platform. In my case this required reading from dev/input/event file and creating the QInput events by myself. Each keyboard input also contains a timestamp which seems to be the timestamp when the input happened.



来源:https://stackoverflow.com/questions/52816955/get-the-timestamp-when-a-qinputevent-was-put-onto-the-queue-of-the-qeventloop-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!