获取将QInputEvent放入Qt 4.8中的QEventLoop队列时的时间戳 [英] Get the timestamp when a QInputEvent was put onto the queue of the QEventLoop in Qt 4.8

查看:249
本文介绍了获取将QInputEvent放入Qt 4.8中的QEventLoop队列时的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与 QEventLoop密切相关:获取事件发生时间已安排.在这里,我专门询问与各种事件"相反的输入事件.我也对Qt 4.8的解决方案感兴趣.

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.

对于Qt 5中的QInputEvent,有一个timestamp()成员方法可以使用.在Qt 4.8中没有这种方法.是否有其他方法来获取驱动程序/深层系统最初发出"输入事件时的时间戳.还是当Qt最初接收"它并将其放入事件队列时?

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?

推荐答案

我研究了嵌入式Qt中不同的键盘/输入驱动程序,发现没有任何时间戳处理.因此,在不满意的情况下可以使用默认的实现.

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.

通过在特定平台上实现自己的逻辑,我设法获得了时间戳.在我的情况下,这需要从dev/input/event文件读取并由我自己创建QInput事件.每个键盘输入还包含一个时间戳,它似乎是输入发生时的时间戳.

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.

这篇关于获取将QInputEvent放入Qt 4.8中的QEventLoop队列时的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆