![]() ![]() ![]() Since programs need to react in varied and complex ways, Qt's event delivery mechanisms are flexible. QMouseEvent supports mouse button presses, double-clicks, moves, and other related operations.Įach event has an associated type, defined in QEvent::Type, and this can be used as a convenient source of run-time type information to quickly determine which subclass a given event object was constructed from. Some classes support more than one actual event type. For example, QResizeEvent adds size() and oldSize() to enable widgets to discover how their dimensions have been changed. Each class subclasses QEvent and adds event-specific functions. Most event types have special classes, notably QResizeEvent, QPaintEvent, QMouseEvent, QKeyEvent, and QCloseEvent. ![]() Some events, such as QMouseEvent and QKeyEvent, come from the window system some, such as QTimerEvent, come from other sources some come from the application itself. This function does not handle the event itself based on the type of event delivered, it calls an event handler for that specific type of event, and sends a response based on whether the event was accepted or ignored. When an event occurs, Qt creates an event object to represent it by constructing an instance of the appropriate QEvent subclass, and delivers it to a particular instance of QObject (or one of its subclasses) by calling its event() function. This document describes how events are delivered and handled in a typical application. Events can be received and handled by any instance of a QObject subclass, but they are especially relevant to widgets. In Qt, events are objects, derived from the abstract QEvent class, that represent things that have happened either within an application or as a result of outside activity that the application needs to know about. ![]()
0 Comments
Leave a Reply. |