Sending events
Many applications that are using the Qt framework want to send their own events, just like the framework-provided events. Suitable custom events can be constructed by using event objects and sending them with QCoreApplication::sendEvent() and QCoreApplication::postEvent().
sendEvent() is synchronous in execution; therefore, it processes the event immediately. For many event classes, there is a function called isAccepted(), which tells us whether the event was accepted or rejected by the last handler that was called.
postEvent() is asynchronous in execution; hence, it posts the event in a queue for later dispatch. The next time Qt's main event loop runs, it dispatches all posted events, with some optimization. For example, if ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access