qeventloop

QEventLoop: get time when an event was scheduled

百般思念 提交于 2019-12-01 11:20:02
问题 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

How to use Qt-Dbus bindings without blocking the main thread

那年仲夏 提交于 2019-12-01 00:52:45
问题 My goal is to create a library using the Qt's DBus bindings. I tried to create a Qt application without launching the QEventLoop (provided by the QCoreApplication class) in the main thread. Here is a minimalistic application sample, working fine using QT-4.6.2 version but blocking on introspection using QT-4.8 or higher. DBusHandler.hpp #pragma once #include <iostream> #include <QtCore/QThread> #include <QtCore/QtCore> #include <QtDBus/QDBusInterface> class DBusHandler : public QThread { Q

Is it possible to create local event loops without calling QApplication::exec()?

喜欢而已 提交于 2019-11-30 04:03:42
问题 I'd like to create a library built on top of QTcpServer and QTcpSocket for use in programs that don't have event loops in their main functions (because the Qt event loop is blocking and doesn't provide enough timing resolution for the real-time operations required). I was hoping to get around this by creating local event loops within the class, but they don't seem to work unless I've called app->exec() in the main function first. Is there some way to create local event loops and allow for