问题
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,
回答1:
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.
来源:https://stackoverflow.com/questions/34682196/qeventloop-get-time-when-an-event-was-scheduled