Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QEvent Class Reference

\inmodule QtCore More...

#include <qcoreevent.h>

+ Inheritance diagram for QEvent:
+ Collaboration diagram for QEvent:

Classes

struct  InputEventTag
 
struct  PointerEventTag
 
struct  SinglePointEventTag
 

Public Types

enum  Type {
  None = 0 , Timer = 1 , MouseButtonPress = 2 , MouseButtonRelease = 3 ,
  MouseButtonDblClick = 4 , MouseMove = 5 , KeyPress = 6 , KeyRelease = 7 ,
  FocusIn = 8 , FocusOut = 9 , FocusAboutToChange = 23 , Enter = 10 ,
  Leave = 11 , Paint = 12 , Move = 13 , Resize = 14 ,
  Create = 15 , Destroy = 16 , Show = 17 , Hide = 18 ,
  Close = 19 , Quit = 20 , ParentChange = 21 , ParentAboutToChange = 131 ,
  ThreadChange = 22 , WindowActivate = 24 , WindowDeactivate = 25 , ShowToParent = 26 ,
  HideToParent = 27 , Wheel = 31 , WindowTitleChange = 33 , WindowIconChange = 34 ,
  ApplicationWindowIconChange = 35 , ApplicationFontChange = 36 , ApplicationLayoutDirectionChange = 37 , ApplicationPaletteChange = 38 ,
  PaletteChange = 39 , Clipboard = 40 , Speech = 42 , MetaCall = 43 ,
  SockAct = 50 , WinEventAct = 132 , DeferredDelete = 52 , DragEnter = 60 ,
  DragMove = 61 , DragLeave = 62 , Drop = 63 , DragResponse = 64 ,
  ChildAdded = 68 , ChildPolished = 69 , ChildRemoved = 71 , ShowWindowRequest = 73 ,
  PolishRequest = 74 , Polish = 75 , LayoutRequest = 76 , UpdateRequest = 77 ,
  UpdateLater = 78 , EmbeddingControl = 79 , ActivateControl = 80 , DeactivateControl = 81 ,
  ContextMenu = 82 , InputMethod = 83 , TabletMove = 87 , LocaleChange = 88 ,
  LanguageChange = 89 , LayoutDirectionChange = 90 , Style = 91 , TabletPress = 92 ,
  TabletRelease = 93 , OkRequest = 94 , HelpRequest = 95 , IconDrag = 96 ,
  FontChange = 97 , EnabledChange = 98 , ActivationChange = 99 , StyleChange = 100 ,
  IconTextChange = 101 , ModifiedChange = 102 , MouseTrackingChange = 109 , WindowBlocked = 103 ,
  WindowUnblocked = 104 , WindowStateChange = 105 , ReadOnlyChange = 106 , ToolTip = 110 ,
  WhatsThis = 111 , StatusTip = 112 , ActionChanged = 113 , ActionAdded = 114 ,
  ActionRemoved = 115 , FileOpen = 116 , Shortcut = 117 , ShortcutOverride = 51 ,
  WhatsThisClicked = 118 , ToolBarChange = 120 , ApplicationActivate = 121 , ApplicationActivated = ApplicationActivate ,
  ApplicationDeactivate = 122 , ApplicationDeactivated = ApplicationDeactivate , QueryWhatsThis = 123 , EnterWhatsThisMode = 124 ,
  LeaveWhatsThisMode = 125 , ZOrderChange = 126 , HoverEnter = 127 , HoverLeave = 128 ,
  HoverMove = 129 , AcceptDropsChange = 152 , ZeroTimerEvent = 154 , GraphicsSceneMouseMove = 155 ,
  GraphicsSceneMousePress = 156 , GraphicsSceneMouseRelease = 157 , GraphicsSceneMouseDoubleClick = 158 , GraphicsSceneContextMenu = 159 ,
  GraphicsSceneHoverEnter = 160 , GraphicsSceneHoverMove = 161 , GraphicsSceneHoverLeave = 162 , GraphicsSceneHelp = 163 ,
  GraphicsSceneDragEnter = 164 , GraphicsSceneDragMove = 165 , GraphicsSceneDragLeave = 166 , GraphicsSceneDrop = 167 ,
  GraphicsSceneWheel = 168 , GraphicsSceneLeave = 220 , KeyboardLayoutChange = 169 , DynamicPropertyChange = 170 ,
  TabletEnterProximity = 171 , TabletLeaveProximity = 172 , NonClientAreaMouseMove = 173 , NonClientAreaMouseButtonPress = 174 ,
  NonClientAreaMouseButtonRelease = 175 , NonClientAreaMouseButtonDblClick = 176 , MacSizeChange = 177 , ContentsRectChange = 178 ,
  MacGLWindowChange = 179 , FutureCallOut = 180 , GraphicsSceneResize = 181 , GraphicsSceneMove = 182 ,
  CursorChange = 183 , ToolTipChange = 184 , NetworkReplyUpdated = 185 , GrabMouse = 186 ,
  UngrabMouse = 187 , GrabKeyboard = 188 , UngrabKeyboard = 189 , StateMachineSignal = 192 ,
  StateMachineWrapped = 193 , TouchBegin = 194 , TouchUpdate = 195 , TouchEnd = 196 ,
  NativeGesture = 197 , RequestSoftwareInputPanel = 199 , CloseSoftwareInputPanel = 200 , WinIdChange = 203 ,
  Gesture = 198 , GestureOverride = 202 , ScrollPrepare = 204 , Scroll = 205 ,
  Expose = 206 , InputMethodQuery = 207 , OrientationChange = 208 , TouchCancel = 209 ,
  ThemeChange = 210 , SockClose = 211 , PlatformPanel = 212 , StyleAnimationUpdate = 213 ,
  ApplicationStateChange = 214 , WindowChangeInternal = 215 , ScreenChangeInternal = 216 , PlatformSurface = 217 ,
  Pointer = 218 , TabletTrackingChange = 219 , WindowAboutToChangeInternal = 221 , DevicePixelRatioChange = 222 ,
  ChildWindowAdded = 223 , ChildWindowRemoved = 224 , ParentWindowAboutToChange = 225 , ParentWindowChange = 226 ,
  User = 1000 , MaxUser = 65535
}
 This enum type defines the valid event types in Qt. More...
 

Public Member Functions

 QEvent (Type type)
 Constructs an event object of type type.
 
virtual ~QEvent ()
 Destroys the event.
 
Type type () const
 Returns the event type.
 
bool spontaneous () const
 Returns true if the event originated outside the application (a system event); otherwise returns false.
 
virtual void setAccepted (bool accepted)
 
bool isAccepted () const
 
void accept ()
 Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
 
void ignore ()
 Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
 
bool isInputEvent () const noexcept
 
bool isPointerEvent () const noexcept
 
bool isSinglePointEvent () const noexcept
 
virtual QEventclone () const
 Creates and returns an identical copy of this event.
 

Static Public Member Functions

static int registerEventType (int hint=-1) noexcept
 

Protected Member Functions

 QEvent (Type type, InputEventTag)
 
 QEvent (Type type, PointerEventTag)
 
 QEvent (Type type, SinglePointEventTag)
 

Protected Attributes

quint16 t
 

Friends

class QCoreApplication
 
class QCoreApplicationPrivate
 
class QThreadData
 
class QApplication
 
class QGraphicsScenePrivate
 
class QSpontaneKeyEvent
 

Detailed Description

\inmodule QtCore

The QEvent class is the base class of all event classes. Event objects contain event parameters.

Qt's main event loop (QCoreApplication::exec()) fetches native window system events from the event queue, translates them into QEvents, and sends the translated events to \l{QObject}s.

In general, events come from the underlying window system (spontaneous() returns true), but it is also possible to manually send events using QCoreApplication::sendEvent() and QCoreApplication::postEvent() (spontaneous() returns false).

\l {QObject}{QObjects} receive events by having their QObject::event() function called. The function can be reimplemented in subclasses to customize event handling and add additional event types; QWidget::event() is a notable example. By default, events are dispatched to event handlers like QObject::timerEvent() and QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an object to intercept events destined for another object.

The basic QEvent contains only an event type parameter and an "accept" flag. The accept flag set with accept(), and cleared with ignore(). It is set by default, but don't rely on this as subclasses may choose to clear it in their constructor.

Subclasses of QEvent contain additional parameters that describe the particular event.

See also
QObject::event(), QObject::installEventFilter(), QCoreApplication::sendEvent(), QCoreApplication::postEvent(), QCoreApplication::processEvents()

Definition at line 44 of file qcoreevent.h.

Member Enumeration Documentation

◆ Type

This enum type defines the valid event types in Qt.

The event types and the specialized classes for each type are as follows:

\value None Not an event. \value ActionAdded A new action has been added (QActionEvent). \value ActionChanged An action has been changed (QActionEvent). \value ActionRemoved An action has been removed (QActionEvent). \value ActivationChange A widget's top-level window activation state has changed. \value ApplicationActivate This enum has been deprecated. Use ApplicationStateChange instead. \value ApplicationActivated This enum has been deprecated. Use ApplicationStateChange instead. \value ApplicationDeactivate This enum has been deprecated. Use ApplicationStateChange instead. \value ApplicationFontChange The default application font has changed. \value ApplicationLayoutDirectionChange The default application layout direction has changed. \value ApplicationPaletteChange The default application palette has changed. \value ApplicationStateChange The state of the application has changed. \value ApplicationWindowIconChange The application's icon has changed. \value ChildAdded An object gets a child (QChildEvent). \value ChildPolished A widget child gets polished (QChildEvent). \value ChildRemoved An object loses a child (QChildEvent). \value [since 6.7] ChildWindowAdded A child window was added to the window. \value [since 6.7] ChildWindowRemoved A child window was removed from the window. \value Clipboard The clipboard contents have changed. \value Close Widget was closed (QCloseEvent). \value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP). \value ContentsRectChange The margins of the widget's content rect changed. \value ContextMenu Context popup menu (QContextMenuEvent). \value CursorChange The widget's cursor has changed. \value DeferredDelete The object will be deleted after it has cleaned up (QDeferredDeleteEvent) \value [since 6.6] DevicePixelRatioChange The devicePixelRatio has changed for this widget's or window's underlying backing store. \value DragEnter The cursor enters a widget during a drag and drop operation (QDragEnterEvent). \value DragLeave The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent). \value DragMove A drag and drop operation is in progress (QDragMoveEvent). \value Drop A drag and drop operation is completed (QDropEvent). \value DynamicPropertyChange A dynamic property was added, changed, or removed from the object. \value EnabledChange Widget's enabled state has changed. \value Enter Mouse enters widget's boundaries (QEnterEvent). \value EnterEditFocus An editor widget gains focus for editing. QT_KEYPAD_NAVIGATION must be defined. \value EnterWhatsThisMode Send to toplevel widgets when the application enters "What's This?" mode. \value Expose Sent to a window when its on-screen contents are invalidated and need to be flushed from the backing store. \value FileOpen File open request (QFileOpenEvent). \value FocusIn Widget or Window gains keyboard focus (QFocusEvent). \value FocusOut Widget or Window loses keyboard focus (QFocusEvent). \value FocusAboutToChange Widget or Window focus is about to change (QFocusEvent) \value FontChange Widget's font has changed. \value Gesture A gesture was triggered (QGestureEvent). \value GestureOverride A gesture override was triggered (QGestureEvent). \value GrabKeyboard Item gains keyboard grab (QGraphicsItem only). \value GrabMouse Item gains mouse grab (QGraphicsItem only). \value GraphicsSceneContextMenu Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). \value GraphicsSceneDragEnter The cursor enters a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). \value GraphicsSceneDragLeave The cursor leaves a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). \value GraphicsSceneDragMove A drag and drop operation is in progress over a scene (QGraphicsSceneDragDropEvent). \value GraphicsSceneDrop A drag and drop operation is completed over a scene (QGraphicsSceneDragDropEvent). \value GraphicsSceneHelp The user requests help for a graphics scene (QHelpEvent). \value GraphicsSceneHoverEnter The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). \value GraphicsSceneHoverLeave The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). \value GraphicsSceneHoverMove The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent). \value GraphicsSceneMouseDoubleClick Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent). \value GraphicsSceneMouseMove Move mouse in a graphics scene (QGraphicsSceneMouseEvent). \value GraphicsSceneMousePress Mouse press in a graphics scene (QGraphicsSceneMouseEvent). \value GraphicsSceneMouseRelease Mouse release in a graphics scene (QGraphicsSceneMouseEvent). \value GraphicsSceneMove Widget was moved (QGraphicsSceneMoveEvent). \value GraphicsSceneResize Widget was resized (QGraphicsSceneResizeEvent). \value GraphicsSceneWheel Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent). \value GraphicsSceneLeave The cursor leaves a graphics scene (QGraphicsSceneWheelEvent). \value Hide Widget was hidden (QHideEvent). \value HideToParent A child widget has been hidden. \value HoverEnter The mouse cursor enters a hover widget (QHoverEvent). \value HoverLeave The mouse cursor leaves a hover widget (QHoverEvent). \value HoverMove The mouse cursor moves inside a hover widget (QHoverEvent). \value IconDrag The main icon of a window has been dragged away (QIconDragEvent). \value IconTextChange Widget's icon text has been changed. (Deprecated) \value InputMethod An input method is being used (QInputMethodEvent). \value InputMethodQuery A input method query event (QInputMethodQueryEvent) \value KeyboardLayoutChange The keyboard layout has changed. \value KeyPress Key press (QKeyEvent). \value KeyRelease Key release (QKeyEvent). \value LanguageChange The application translation changed. \value LayoutDirectionChange The direction of layouts changed. \value LayoutRequest Widget layout needs to be redone. \value Leave Mouse leaves widget's boundaries. \value LeaveEditFocus An editor widget loses focus for editing. QT_KEYPAD_NAVIGATION must be defined. \value LeaveWhatsThisMode Send to toplevel widgets when the application leaves "What's This?" mode. \value LocaleChange The system locale has changed. \value NonClientAreaMouseButtonDblClick A mouse double click occurred outside the client area (QMouseEvent). \value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area (QMouseEvent). \value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area (QMouseEvent). \value NonClientAreaMouseMove A mouse move occurred outside the client area (QMouseEvent). \value MacSizeChange The user changed his widget sizes (\macos only). \value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod(). \value ModifiedChange Widgets modification state has been changed. \value MouseButtonDblClick Mouse press again (QMouseEvent). \value MouseButtonPress Mouse press (QMouseEvent). \value MouseButtonRelease Mouse release (QMouseEvent). \value MouseMove Mouse move (QMouseEvent). \value MouseTrackingChange The mouse tracking state has changed. \value Move Widget's position changed (QMoveEvent). \value NativeGesture The system has detected a gesture (QNativeGestureEvent). \value OrientationChange The screens orientation has changes (QScreenOrientationChangeEvent). \value Paint Screen update necessary (QPaintEvent). \value PaletteChange Palette of the widget changed. \value ParentAboutToChange The object parent is about to change. Only sent to some object types, such as QWidget. \value ParentChange The object parent has changed. Only sent to some object types, such as QWidget. \value [since 6.7] ParentWindowAboutToChange The parent window is about to change. \value [since 6.7] ParentWindowChange The parent window has changed. \value PlatformPanel A platform specific panel has been requested. \value PlatformSurface A native platform surface has been created or is about to be destroyed (QPlatformSurfaceEvent). \omitvalue Pointer \value Polish The widget is polished. \value PolishRequest The widget should be polished. \value QueryWhatsThis The widget should accept the event if it has "What's This?" help (QHelpEvent). \value Quit The application has exited. \value [since 5.4] ReadOnlyChange Widget's read-only state has changed. \value RequestSoftwareInputPanel A widget wants to open a software input panel (SIP). \value Resize Widget's size changed (QResizeEvent). \value ScrollPrepare The object needs to fill in its geometry information (QScrollPrepareEvent). \value Scroll The object needs to scroll to the supplied position (QScrollEvent). \value Shortcut Key press in child for shortcut key handling (QShortcutEvent). \value ShortcutOverride Key press in child, for overriding shortcut key handling (QKeyEvent). When a shortcut is about to trigger, ShortcutOverride is sent to the active window. This allows clients (e.g. widgets) to signal that they will handle the shortcut themselves, by accepting the event. If the shortcut override is accepted, the event is delivered as a normal key press to the focus widget. Otherwise, it triggers the shortcut action, if one exists. \value Show Widget was shown on screen (QShowEvent). \value ShowToParent A child widget has been shown. \value SockAct Socket activated, used to implement QSocketNotifier. \omitvalue SockClose \value StateMachineSignal A signal delivered to a state machine (QStateMachine::SignalEvent). \value StateMachineWrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent). \value StatusTip A status tip is requested (QStatusTipEvent). \value StyleChange Widget's style has been changed. \value TabletMove Wacom tablet move (QTabletEvent). \value TabletPress Wacom tablet press (QTabletEvent). \value TabletRelease Wacom tablet release (QTabletEvent). \omitvalue OkRequest \value TabletEnterProximity Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. \value TabletLeaveProximity Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. \value [since 5.9] TabletTrackingChange The Wacom tablet tracking state has changed. \omitvalue ThemeChange \value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread(). \value Timer Regular timer events (QTimerEvent). \value ToolBarChange The toolbar button is toggled on \macos. \value ToolTip A tooltip was requested (QHelpEvent). \value ToolTipChange The widget's tooltip has changed. \value TouchBegin Beginning of a sequence of touch-screen or track-pad events (QTouchEvent). \value TouchCancel Cancellation of touch-event sequence (QTouchEvent). \value TouchEnd End of touch-event sequence (QTouchEvent). \value TouchUpdate Touch-screen event (QTouchEvent). \value UngrabKeyboard Item loses keyboard grab (QGraphicsItem only). \value UngrabMouse Item loses mouse grab (QGraphicsItem, QQuickItem). \value UpdateLater The widget should be queued to be repainted at a later time. \value UpdateRequest The widget should be repainted. \value WhatsThis The widget should reveal "What's This?" help (QHelpEvent). \value WhatsThisClicked A link in a widget's "What's This?" help was clicked. \value Wheel Mouse wheel rolled (QWheelEvent). \value WinEventAct A Windows-specific activation event has occurred. \value WindowActivate Window was activated. \value WindowBlocked The window is blocked by a modal dialog. \value WindowDeactivate Window was deactivated. \value WindowIconChange The window's icon has changed. \value WindowStateChange The \l{QWindow::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). \value WindowTitleChange The window title has changed. \value WindowUnblocked The window is unblocked after a modal dialog exited. \value WinIdChange The window system identifier for this native widget has changed. \value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows.

User events should have values between User and {MaxUser}:

\value User User-defined event. \value MaxUser Last user event ID.

For convenience, you can use the registerEventType() function to register and reserve a custom event type for your application. Doing so will allow you to avoid accidentally re-using a custom event type already in use elsewhere in your application.

\omitvalue AcceptDropsChange \omitvalue ActivateControl \omitvalue Create \omitvalue DeactivateControl \omitvalue Destroy \omitvalue DragResponse \omitvalue EmbeddingControl \omitvalue HelpRequest \omitvalue Quit \omitvalue ShowWindowRequest \omitvalue Speech \omitvalue Style \omitvalue StyleAnimationUpdate \omitvalue ZeroTimerEvent \omitvalue ApplicationActivate \omitvalue ApplicationActivated \omitvalue ApplicationDeactivate \omitvalue ApplicationDeactivated \omitvalue MacGLWindowChange \omitvalue NetworkReplyUpdated \omitvalue FutureCallOut \omitvalue NativeGesture \omitvalue WindowChangeInternal \omitvalue ScreenChangeInternal \omitvalue WindowAboutToChangeInternal

Enumerator
None 
Timer 
MouseButtonPress 
MouseButtonRelease 
MouseButtonDblClick 
MouseMove 
KeyPress 
KeyRelease 
FocusIn 
FocusOut 
FocusAboutToChange 
Enter 
Leave 
Paint 
Move 
Resize 
Create 
Destroy 
Show 
Hide 
Close 
Quit 
ParentChange 
ParentAboutToChange 
ThreadChange 
WindowActivate 
WindowDeactivate 
ShowToParent 
HideToParent 
Wheel 
WindowTitleChange 
WindowIconChange 
ApplicationWindowIconChange 
ApplicationFontChange 
ApplicationLayoutDirectionChange 
ApplicationPaletteChange 
PaletteChange 
Clipboard 
Speech 
MetaCall 
SockAct 
WinEventAct 
DeferredDelete 
DragEnter 
DragMove 
DragLeave 
Drop 
DragResponse 
ChildAdded 
ChildPolished 
ChildRemoved 
ShowWindowRequest 
PolishRequest 
Polish 
LayoutRequest 
UpdateRequest 
UpdateLater 
EmbeddingControl 
ActivateControl 
DeactivateControl 
ContextMenu 
InputMethod 
TabletMove 
LocaleChange 
LanguageChange 
LayoutDirectionChange 
Style 
TabletPress 
TabletRelease 
OkRequest 
HelpRequest 
IconDrag 
FontChange 
EnabledChange 
ActivationChange 
StyleChange 
IconTextChange 
ModifiedChange 
MouseTrackingChange 
WindowBlocked 
WindowUnblocked 
WindowStateChange 
ReadOnlyChange 
ToolTip 
WhatsThis 
StatusTip 
ActionChanged 
ActionAdded 
ActionRemoved 
FileOpen 
Shortcut 
ShortcutOverride 
WhatsThisClicked 
ToolBarChange 
ApplicationActivate 
ApplicationActivated 
ApplicationDeactivate 
ApplicationDeactivated 
QueryWhatsThis 
EnterWhatsThisMode 
LeaveWhatsThisMode 
ZOrderChange 
HoverEnter 
HoverLeave 
HoverMove 
AcceptDropsChange 
ZeroTimerEvent 
GraphicsSceneMouseMove 
GraphicsSceneMousePress 
GraphicsSceneMouseRelease 
GraphicsSceneMouseDoubleClick 
GraphicsSceneContextMenu 
GraphicsSceneHoverEnter 
GraphicsSceneHoverMove 
GraphicsSceneHoverLeave 
GraphicsSceneHelp 
GraphicsSceneDragEnter 
GraphicsSceneDragMove 
GraphicsSceneDragLeave 
GraphicsSceneDrop 
GraphicsSceneWheel 
GraphicsSceneLeave 
KeyboardLayoutChange 
DynamicPropertyChange 
TabletEnterProximity 
TabletLeaveProximity 
NonClientAreaMouseMove 
NonClientAreaMouseButtonPress 
NonClientAreaMouseButtonRelease 
NonClientAreaMouseButtonDblClick 
MacSizeChange 
ContentsRectChange 
MacGLWindowChange 
FutureCallOut 
GraphicsSceneResize 
GraphicsSceneMove 
CursorChange 
ToolTipChange 
NetworkReplyUpdated 
GrabMouse 
UngrabMouse 
GrabKeyboard 
UngrabKeyboard 
StateMachineSignal 
StateMachineWrapped 
TouchBegin 
TouchUpdate 
TouchEnd 
NativeGesture 
RequestSoftwareInputPanel 
CloseSoftwareInputPanel 
WinIdChange 
Gesture 
GestureOverride 
ScrollPrepare 
Scroll 
Expose 
InputMethodQuery 
OrientationChange 
TouchCancel 
ThemeChange 
SockClose 
PlatformPanel 
StyleAnimationUpdate 
ApplicationStateChange 
WindowChangeInternal 
ScreenChangeInternal 
PlatformSurface 
Pointer 
TabletTrackingChange 
WindowAboutToChangeInternal 
DevicePixelRatioChange 
ChildWindowAdded 
ChildWindowRemoved 
ParentWindowAboutToChange 
ParentWindowChange 
User 
MaxUser 

Definition at line 51 of file qcoreevent.h.

Constructor & Destructor Documentation

◆ QEvent() [1/4]

QEvent::QEvent ( Type type)
explicit

Constructs an event object of type type.

Definition at line 275 of file qcoreevent.cpp.

References Q_TRACE.

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~QEvent()

QEvent::~QEvent ( )
virtual

Destroys the event.

If it was \l{QCoreApplication::postEvent()}{posted}, it will be removed from the list of events to be posted.

Definition at line 328 of file qcoreevent.cpp.

References QCoreApplication::instance(), and QCoreApplicationPrivate::removePostedEvent().

+ Here is the call graph for this function:

◆ QEvent() [2/4]

QEvent::QEvent ( Type type,
QEvent::InputEventTag  )
inlineprotected
Since
6.0

Constructs an event object of type type, setting the inputEvent flag to true.

Definition at line 323 of file qcoreevent.h.

◆ QEvent() [3/4]

QEvent::QEvent ( Type type,
QEvent::PointerEventTag  )
inlineprotected
Since
6.0

Constructs an event object of type type, setting the pointerEvent and inputEvent flags to true.

Definition at line 325 of file qcoreevent.h.

◆ QEvent() [4/4]

QEvent::QEvent ( Type type,
QEvent::SinglePointEventTag  )
inlineprotected
Since
6.0

Constructs an event object of type type, setting the singlePointEvent, pointerEvent and inputEvent flags to true.

Definition at line 327 of file qcoreevent.h.

Member Function Documentation

◆ accept()

void QEvent::accept ( )
inline

Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget.

See also
ignore()

Definition at line 310 of file qcoreevent.h.

Referenced by QDialog::closeEvent(), QAlphaWidget::closeEvent(), QRollEffect::closeEvent(), QQuickItemPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverToPassiveGrabbers(), QKeySequenceEdit::event(), QMenu::event(), QMenuBar::event(), QQuickWindow::event(), QQuickTextInput::event(), QWindowContainer::event(), QQuickDeliveryAgent::event(), QWidget::event(), QBasicDrag::eventFilter(), QComboBoxPrivateContainer::eventFilter(), QWidgetResizeHandler::eventFilter(), QFontDialog::eventFilter(), QQuickComboBox::eventFilter(), QQuickItemPrivate::filterKeyEvent(), QColorDialogPrivate::handleColorPickingKeyPress(), QKeySequenceEdit::keyPressEvent(), QMenu::keyPressEvent(), QMenuBar::keyPressEvent(), QWidgetTextControlPrivate::keyPressEvent(), QQuickTextControlPrivate::keyPressEvent(), QFileDialogLineEdit::keyPressEvent(), QFileDialogListView::keyPressEvent(), QFileDialogTreeView::keyPressEvent(), QComboBox::keyPressEvent(), QPlainTextEdit::keyPressEvent(), QTextEdit::keyPressEvent(), QGraphicsScene::keyPressEvent(), QKeySequenceEdit::keyReleaseEvent(), QTextEdit::keyReleaseEvent(), QGraphicsScene::keyReleaseEvent(), QGraphicsScene::mouseMoveEvent(), QAbstractButton::mouseMoveEvent(), QDial::mouseMoveEvent(), QAbstractButton::mousePressEvent(), QDial::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QGraphicsScene::mouseReleaseEvent(), QAbstractButton::mouseReleaseEvent(), QDial::mouseReleaseEvent(), and QWidgetTextControl::processEvent().

+ Here is the caller graph for this function:

◆ clone()

QEvent * QEvent::clone ( ) const
virtual

Creates and returns an identical copy of this event.

Since
6.0

Definition at line 338 of file qcoreevent.cpp.

References QEvent().

Referenced by QQuickDeliveryAgentPrivate::clonePointerEvent(), and copyMouseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ignore()

void QEvent::ignore ( )
inline

Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Clearing the accept parameter indicates that the event receiver does not want the event. Unwanted events might be propagated to the parent widget.

See also
accept()

Definition at line 311 of file qcoreevent.h.

Referenced by QKeyEvent::QKeyEvent(), QKeyEvent::QKeyEvent(), QMdiSubWindow::changeEvent(), QDialog::closeEvent(), QMessageBox::closeEvent(), QWidgetTextControlPrivate::dragEnterEvent(), QWidgetTextControlPrivate::dragMoveEvent(), QGuiApplication::event(), QApplication::event(), QWaylandQuickShellEventFilter::eventFilter(), QGraphicsScene::focusInEvent(), QWidgetTextControlPrivate::inputMethodEvent(), QComboBox::inputMethodEvent(), QtPrivate::QWellArray::keyPressEvent(), QDialog::keyPressEvent(), QMenu::keyPressEvent(), QMenuBar::keyPressEvent(), QTabWidget::keyPressEvent(), QWidgetTextControlPrivate::keyPressEvent(), QQuickTextControlPrivate::keyPressEvent(), QAbstractButton::keyPressEvent(), QComboBox::keyPressEvent(), QPlainTextEdit::keyPressEvent(), QTextEdit::keyPressEvent(), QGraphicsScene::keyPressEvent(), QMdiSubWindow::keyPressEvent(), QQuickTextControlPrivate::keyReleaseEvent(), QAbstractButton::keyReleaseEvent(), QTextEdit::keyReleaseEvent(), QGraphicsScene::keyReleaseEvent(), QWidgetTextControlPrivate::mouseDoubleClickEvent(), QQuickTextControlPrivate::mouseDoubleClickEvent(), QMdi::ControlLabel::mouseDoubleClickEvent(), QMdiSubWindow::mouseDoubleClickEvent(), QAbstractButton::mouseMoveEvent(), QDial::mouseMoveEvent(), QWidgetTextControlPrivate::mousePressEvent(), QAbstractButton::mousePressEvent(), QQuickTextControlPrivate::mousePressEvent(), QDial::mousePressEvent(), QMdi::ControlLabel::mousePressEvent(), QMdiSubWindow::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QWidgetTextControlPrivate::mouseReleaseEvent(), QGraphicsScene::mouseReleaseEvent(), QAbstractButton::mouseReleaseEvent(), QDial::mouseReleaseEvent(), QMdi::ControlLabel::mouseReleaseEvent(), QMdiSubWindow::mouseReleaseEvent(), QApplication::notify(), QQuickTextControl::processEvent(), QWidgetTextControl::processEvent(), QLabelPrivate::sendControlEvent(), QRubberBand::showEvent(), and QComboBoxPrivate::showPopupFromMouseEvent().

◆ isAccepted()

bool QEvent::isAccepted ( ) const
inline

Definition at line 308 of file qcoreevent.h.

Referenced by QWhatsThisPrivate::QWhatsThisPrivate(), _q_hoverFromMouseEvent(), QQuickWindow::closeEvent(), QQuickItemPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverTouchAsMouse(), QApplication::event(), QQuickWidget::event(), QPlainTextEdit::event(), QTextEdit::event(), QWindowContainer::event(), QGraphicsProxyWidget::event(), QWidget::event(), QWhatsThisPrivate::eventFilter(), QCompleter::eventFilter(), QQuickItemPrivate::filterKeyEvent(), QWidgetPrivate::handleClose(), QPlainTextEdit::keyPressEvent(), QTextEdit::keyPressEvent(), QGraphicsScene::keyPressEvent(), QGraphicsScene::keyReleaseEvent(), QGraphicsView::mouseDoubleClickEvent(), QGraphicsViewPrivate::mouseMoveEventHandler(), QGraphicsView::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QGraphicsView::mouseReleaseEvent(), QApplication::notify(), QWidgetTextControl::processEvent(), QGuiApplicationPrivate::processExposeEvent(), QGuiApplicationPrivate::processPaintEvent(), QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl(), QQuickDeliveryAgentPrivate::sendHoverEvent(), QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(), QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(), and QGraphicsView::viewportEvent().

+ Here is the caller graph for this function:

◆ isInputEvent()

bool QEvent::isInputEvent ( ) const
inlinenoexcept
Since
6.0

Returns true if the event object is a QInputEvent or one of its subclasses.

Definition at line 313 of file qcoreevent.h.

◆ isPointerEvent()

bool QEvent::isPointerEvent ( ) const
inlinenoexcept
Since
6.0

Returns true if the event object is a QPointerEvent or one of its subclasses.

Definition at line 314 of file qcoreevent.h.

Referenced by QQuickFlickable::childMouseEventFilter(), and QQuickPathView::childMouseEventFilter().

+ Here is the caller graph for this function:

◆ isSinglePointEvent()

bool QEvent::isSinglePointEvent ( ) const
inlinenoexcept
Since
6.0

Returns true if the event object is a subclass of QSinglePointEvent.

Definition at line 315 of file qcoreevent.h.

Referenced by QQuickFlickable::childMouseEventFilter(), and QQuickWindowPrivate::clearGrabbers().

+ Here is the caller graph for this function:

◆ registerEventType()

int QEvent::registerEventType ( int hint = -1)
staticnoexcept
Since
4.4 \threadsafe

Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser.

Returns -1 if all available values are already taken or the program is shutting down.

Definition at line 504 of file qcoreevent.cpp.

References hint(), MaxUser, and registerEventTypeZeroBased().

+ Here is the call graph for this function:

◆ setAccepted()

◆ spontaneous()

bool QEvent::spontaneous ( ) const
inline

Returns true if the event originated outside the application (a system event); otherwise returns false.

Definition at line 305 of file qcoreevent.h.

Referenced by QGuiApplicationPrivate::captureGlobalModifierState(), QQuickDeliveryAgentPrivate::deliverKeyEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QApplication::notify(), and operator<<().

+ Here is the caller graph for this function:

◆ type()

QEvent::Type QEvent::type ( ) const
inline

Returns the event type.

Definition at line 304 of file qcoreevent.h.

Referenced by QGuiApplicationPrivate::captureGlobalModifierState(), QMenu::changeEvent(), QMenuBar::changeEvent(), QRubberBand::changeEvent(), QToolButton::changeEvent(), QErrorMessage::changeEvent(), QFileDialog::changeEvent(), QAbstractButton::changeEvent(), QComboBox::changeEvent(), QComboBoxPrivateContainer::changeEvent(), QPlainTextEdit::changeEvent(), QTextEdit::changeEvent(), QColorDialog::changeEvent(), QFontDialog::changeEvent(), QDockWidget::changeEvent(), QLayout::childEvent(), QQuickFlickable::childMouseEventFilter(), QQuickMouseArea::childMouseEventFilter(), QQuickPinchArea::childMouseEventFilter(), QDialogPrivate::close(), copyMouseEvent(), QQuickItemPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverKeyEvent(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QCoreApplication::event(), QSocketNotifier::event(), QAction::event(), QGuiApplication::event(), QWindow::event(), QNetworkReplyImpl::event(), QReadNotifier::event(), QWriteNotifier::event(), QExceptionNotifier::event(), QApplication::event(), QSystemTrayIconSys::event(), QKeySequenceEdit::event(), QLineEdit::event(), QMenu::event(), QMenuBar::event(), QScrollArea::event(), QSplitter::event(), QStatusBar::event(), QQmlThreadPrivate::event(), QQmlEngine::event(), QQmlTimer::event(), QQmlDelegateModel::event(), QQmlListModelWorkerAgent::event(), QQuickPointerHandler::event(), QQuickItemGrabResult::event(), QSGRenderThread::event(), QSGThreadedRenderLoop::event(), QQuickWidget::event(), EVRCustomPresenter::event(), src_gui_vulkan_qvulkaninstance2::VulkanWindow::event(), QMacStyle::event(), QWindowsPipeReader::event(), QWindowsPipeWriter::event(), QEventDispatcherWin32::event(), QShortcut::event(), QOpenGLWidget::event(), QXcbConnection::event(), QMessageBox::event(), QHeaderView::event(), QTreeWidget::event(), QRhiWidget::event(), QProxyStyle::event(), QAbstractButton::event(), QAbstractSlider::event(), QCheckBox::event(), QFocusFrame::event(), QFontComboBox::event(), QFrame::event(), QLabel::event(), QPlainTextEdit::event(), QProgressBar::event(), QPushButton::event(), QRadioButton::event(), QSplashScreen::event(), QTextEdit::event(), QQuickLabsPlatformMenuItem::event(), QQuickContext2DTexture::event(), QSGSoftwareRenderThread::event(), QSGSoftwareThreadedRenderLoop::event(), ReaderThreadExecutionEnforcer::event(), QQuickComboBox::event(), QQuickDialogButtonBox::event(), QVideoWindow::event(), QOpenXRManager::event(), QWindowContainer::event(), QObject::event(), QGroupBox::event(), QToolBar::event(), QTipLabel::eventFilter(), QWhatsThisPrivate::eventFilter(), QAlphaWidget::eventFilter(), QFocusFrame::eventFilter(), QScrollArea::eventFilter(), QSizeGrip::eventFilter(), QWaylandQuickShellEventFilter::eventFilter(), QWindowContainer::eventFilter(), QBasicDrag::eventFilter(), QCompleter::eventFilter(), QtPrivate::QCalendarTextNavigator::eventFilter(), QComboBoxPrivateContainer::eventFilter(), QWidgetResizeHandler::eventFilter(), QFontDialog::eventFilter(), QIBusPlatformInputContext::filterEvent(), QQuickItemPrivate::filterKeyEvent(), QQuickTextControlPrivate::hoverEvent(), QSinglePointEvent::isUpdateEvent(), QQuickWidget::mouseDoubleClickEvent(), QMenuPrivate::mouseEventTaken(), QQuickWidget::mouseMoveEvent(), QQuickWidget::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), QQuickWidget::mouseReleaseEvent(), QApplication::notify(), QApplicationPrivate::notify_helper(), operator<<(), QFbCursor::pointerEvent(), QQuickTextControl::processEvent(), QWidgetTextControl::processEvent(), QQuickMultiPointTouchArea::sendMouseEvent(), PressDelayHandler::sendMouseEvent(), QLineEditPrivate::sendMouseEventToInputContext(), QQuickTextControlPrivate::sendMouseEventToInputContext(), QComboBoxPrivate::showPopupFromMouseEvent(), QQuickMultiPointTouchArea::updateTouchPoint(), QHeaderView::viewportEvent(), QLayout::widgetEvent(), and QGraphicsLayout::widgetEvent().

Friends And Related Symbol Documentation

◆ QApplication

friend class QApplication
friend

Definition at line 354 of file qcoreevent.h.

◆ QCoreApplication

friend class QCoreApplication
friend

Definition at line 351 of file qcoreevent.h.

◆ QCoreApplicationPrivate

friend class QCoreApplicationPrivate
friend

Definition at line 352 of file qcoreevent.h.

◆ QGraphicsScenePrivate

friend class QGraphicsScenePrivate
friend

Definition at line 355 of file qcoreevent.h.

◆ QSpontaneKeyEvent

friend class QSpontaneKeyEvent
friend

Definition at line 359 of file qcoreevent.h.

◆ QThreadData

friend class QThreadData
friend

Definition at line 353 of file qcoreevent.h.

Member Data Documentation

◆ t

quint16 QEvent::t
protected

Definition at line 328 of file qcoreevent.h.


The documentation for this class was generated from the following files: