Event handler 2026-11-05
An event handler is code invoked to respond to a particular software event, such as a key press, resize or completed operation. The event's data identifies what happened; the event handler interprets it using the application's current state. Qt dispatches an event object to its target and then to an appropriate event-specific method.[ref]
For example, a resize event handler can recompute a plot's displayed layout from the new dimensions. A later paint software event draws that layout. Keeping each response short lets an event loop handle other work promptly. When delivery is delayed, the application's state may already have changed, so the original occurrence and its eventual handling must be distinguished.
Software event 2026-11-05
A software event represents an occurrence that a program can observe and handle, such as a key press, timer expiry or completed operation. It may carry data identifying what happened, where and to which object. An event handler performs the relevant response; an event loop commonly dispatches pending events to their destinations.
In Qt, an event object is delivered to a target object whose event method dispatches to a type-specific handler. Mouse, keyboard, resize and timer events carry different information.[ref] A queued event can be handled after the original occurrence, so event time and handling time differ. Reentrant or asynchronous handlers must also account for changes in application state between those moments.