QEventLoop:获取安排事件的时间 [英] QEventLoop: get time when an event was scheduled

查看:42
本文介绍了QEventLoop:获取安排事件的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取事件被调度到 QEventLoop(例如 QCoreApplication 事件循环)的时间?

我遇到了主事件循环暂停的情况.当它重新激活时,事件被触发,我对事件添加到队列的时间感兴趣.这些事件不是自定义事件,而是系统(和其他)事件.

问候,

解决方案

主要看你感兴趣的系统事件是什么,因为有些情况下你已经有了timestamp.

例如,QInputEvent(事件的基类描述用户输入,如QMouseEventQKeyEvent等)具有成员方法时间戳:

<块引用>

返回此事件的窗口系统时间戳.

换句话说,接近于被推入事件循环的时间的时间戳.

Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)?

I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the time when the events where added to the queue. The events are not custom events but system (and other) events.

Regards,

解决方案

It mainly depends on what are the system events you are interested in, for you have already the timestamp in some cases.

As an example, QInputEvent (base class for events that describe user input, like QMouseEvent, QKeyEvent, and so on) has the member method timestamp that:

Returns the window system's timestamp for this event.

In other terms, a timestamp close to the time when it has been pushed into the event loop.

这篇关于QEventLoop:获取安排事件的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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