Get the timestamp when a QInputEvent was put onto

2019-03-04 16:51发布

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?

标签: c++ qt qt4.8
1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-04 17:21

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.

查看更多
登录 后发表回答