QEvent(3qt)
β¨ NAME β¨
QEvent β bestie, this is the base class of all event classes, like the mother of every event object out there. Event objects contain event parameters. That's the whole job. π
(also this is from the QEvent(3qt) manual, so jot that down π)
π¦ SYNOPSIS π¦
#include <qevent.h>
Inherits Qt.
Inherited by QTimerEvent, QMouseEvent, QWheelEvent, QTabletEvent, QKeyEvent, QFocusEvent, QPaintEvent, QMoveEvent, QResizeEvent, QCloseEvent, QIconDragEvent, QShowEvent, QHideEvent, QContextMenuEvent, QIMEvent, QDropEvent, QDragLeaveEvent, QChildEvent, and QCustomEvent. That's a whole friend group fr fr π
Public Members π
enum Typeβ the big list of event types, full tea below β¬οΈQEvent ( Type type )β makes a new event of type typevirtual ~QEvent ()β destroys itType type () constβ tells you the event typebool spontaneous () constβ was it a real system event or nah
And here's the enum Type in all its glory, exactly as it lives:
enum Type { None = 0, Timer = 1, MouseButtonPress = 2,
MouseButtonRelease = 3, MouseButtonDblClick = 4, MouseMove = 5,
KeyPress = 6, KeyRelease = 7, FocusIn = 8, FocusOut = 9, Enter = 10,
Leave = 11, Paint = 12, Move = 13, Resize = 14, Create = 15, Destroy
= 16, Show = 17, Hide = 18, Close = 19, Quit = 20, Reparent = 21,
ShowMinimized = 22, ShowNormal = 23, WindowActivate = 24,
WindowDeactivate = 25, ShowToParent = 26, HideToParent = 27,
ShowMaximized = 28, ShowFullScreen = 29, Accel = 30, Wheel = 31,
AccelAvailable = 32, CaptionChange = 33, IconChange = 34,
ParentFontChange = 35, ApplicationFontChange = 36,
ParentPaletteChange = 37, ApplicationPaletteChange = 38,
PaletteChange = 39, Clipboard = 40, Speech = 42, SockAct = 50,
AccelOverride = 51, DeferredDelete = 52, DragEnter = 60, DragMove =
61, DragLeave = 62, Drop = 63, DragResponse = 64, ChildInserted =
70, ChildRemoved = 71, LayoutHint = 72, ShowWindowRequest = 73,
WindowBlocked = 74, WindowUnblocked = 75, ActivateControl = 80,
DeactivateControl = 81, ContextMenu = 82, IMStart = 83, IMCompose =
84, IMEnd = 85, Accessibility = 86, TabletMove = 87, LocaleChange =
88, LanguageChange = 89, LayoutDirectionChange = 90, Style = 91,
TabletPress = 92, TabletRelease = 93, OkRequest = 94, HelpRequest =
95, WindowStateChange = 96, IconDrag = 97, User = 1000, MaxUser =
65535 }
π DESCRIPTION π
So. QEvent is the base class of all event classes. Event objects contain event parameters. Iconic behaviour honestly.
Qt's main event loop (QApplication::exec()) goes and fetches native window system events from the event queue, translates them into QEvents, and sends those translated events off to QObjects. It's giving matchmaker but for signals of the computer variety π
In general, events come from the underlying window system (spontaneous() returns TRUE) β but plot twist, you can also manually send events using QApplication::sendEvent() and QApplication::postEvent() (and then spontaneous() returns FALSE). No cap.
QObjects receive events by having their QObject::event() function called. You can reimplement that function in subclasses to customize event handling and add additional event types β QWidget::event() is the famous example, main character energy fr. By default, events are dispatched to event handlers like QObject::timerEvent() and QWidget::mouseMoveEvent(). And QObject::installEventFilter() lets an object intercept events destined for another object. Sneaky. Obsessed. π
The basic QEvent contains only an event type parameter. Subclasses of QEvent contain additional parameters that describe the particular event β that's where the extra lore lives.
See also QObject::event(), QObject::installEventFilter(), QWidget::event(), QApplication::sendEvent(), QApplication::postEvent(), QApplication::processEvents(), Environment Classes, and Event Classes. β¨
Member Type Documentation πΈ
QEvent::Type
This enum type defines the valid event types in Qt. The event types and the specialized classes for each type are these β buckle up, it's a long list but every single one matters:
QEvent::Noneβ Not an event.QEvent::Accessibilityβ Accessibility information is requestedQEvent::Timerβ Regular timer events,QTimerEvent.QEvent::MouseButtonPressβ Mouse press,QMouseEvent.QEvent::MouseButtonReleaseβ Mouse release,QMouseEvent.QEvent::MouseButtonDblClickβ Mouse press again,QMouseEvent.QEvent::MouseMoveβ Mouse move,QMouseEvent.QEvent::KeyPressβ Key press (including Shift, for example),QKeyEvent.QEvent::KeyReleaseβ Key release,QKeyEvent.QEvent::IMStartβ The start of input method composition,QIMEvent.QEvent::IMComposeβ Input method composition is taking place,QIMEvent.QEvent::IMEndβ The end of input method composition,QIMEvent.QEvent::FocusInβ Widget gains keyboard focus,QFocusEvent.QEvent::FocusOutβ Widget loses keyboard focus,QFocusEvent.QEvent::Enterβ Mouse enters widget's boundaries.QEvent::Leaveβ Mouse leaves widget's boundaries.QEvent::Paintβ Screen update necessary,QPaintEvent.QEvent::Moveβ Widget's position changed,QMoveEvent.QEvent::Resizeβ Widget's size changed,QResizeEvent.QEvent::Showβ Widget was shown on screen,QShowEvent.QEvent::Hideβ Widget was hidden,QHideEvent.QEvent::ShowToParentβ A child widget has been shown.QEvent::HideToParentβ A child widget has been hidden.QEvent::Closeβ Widget was closed (permanently),QCloseEvent.QEvent::ShowNormalβ Widget should be shown normally (obsolete).QEvent::ShowMaximizedβ Widget should be shown maximized (obsolete).QEvent::ShowMinimizedβ Widget should be shown minimized (obsolete).QEvent::ShowFullScreenβ Widget should be shown full-screen (obsolete).QEvent::ShowWindowRequestβ Widget's window should be shown (obsolete).QEvent::DeferredDeleteβ The object will be deleted after it has cleaned up.QEvent::Accelβ Key press in child for shortcut key handling,QKeyEvent.QEvent::Wheelβ Mouse wheel rolled,QWheelEvent.QEvent::ContextMenuβ Context popup menu,QContextMenuEventQEvent::AccelOverrideβ Key press in child, for overriding shortcut key handling,QKeyEvent.QEvent::AccelAvailableβ internal.QEvent::WindowActivateβ Window was activated.QEvent::WindowDeactivateβ Window was deactivated.QEvent::CaptionChangeβ Widget's caption changed.QEvent::IconChangeβ Widget's icon changed.QEvent::ParentFontChangeβ Font of the parent widget changed.QEvent::ApplicationFontChangeβ Default application font changed.QEvent::PaletteChangeβ Palette of the widget changed.QEvent::ParentPaletteChangeβ Palette of the parent widget changed.QEvent::ApplicationPaletteChangeβ Default application palette changed.QEvent::Clipboardβ Clipboard contents have changed.QEvent::SockActβ Socket activated, used to implementQSocketNotifier.QEvent::DragEnterβ A drag-and-drop enters widget,QDragEnterEvent.QEvent::DragMoveβ A drag-and-drop is in progress,QDragMoveEvent.QEvent::DragLeaveβ A drag-and-drop leaves widget,QDragLeaveEvent.QEvent::Dropβ A drag-and-drop is completed,QDropEvent.QEvent::DragResponseβ Internal event used by Qt on some platforms.QEvent::ChildInsertedβ Object gets a child,QChildEvent.QEvent::ChildRemovedβ Object loses a child,QChildEvent.QEvent::LayoutHintβ Widget child has changed layout properties.QEvent::ActivateControlβ Internal event used by Qt on some platforms.QEvent::DeactivateControlβ Internal event used by Qt on some platforms.QEvent::LanguageChangeβ The application translation changed,QTranslatorQEvent::LayoutDirectionChangeβ The direction of layouts changedQEvent::LocaleChangeβ The system locale changedQEvent::Quitβ Reserved.QEvent::Createβ Reserved.QEvent::Destroyβ Reserved.QEvent::Reparentβ Reserved.QEvent::Speechβ Reserved for speech input.QEvent::TabletMoveβ A Wacom Tablet Move Event.QEvent::Styleβ Internal use onlyQEvent::TabletPressβ A Wacom Tablet Press EventQEvent::TabletReleaseβ A Wacom Tablet Release EventQEvent::OkRequestβ Internal event used by Qt on some platforms.QEvent::HelpRequestβ Internal event used by Qt on some platforms.QEvent::IconDragβ Internal event used by Qt on some platforms when proxy icon is dragged.QEvent::WindowStateChangeβ The window's state, i.e. minimized, maximized or full-screen, has changed. SeeQWidget::windowState().QEvent::WindowBlockedβ The window is modally blockedQEvent::WindowUnblockedβ The window leaves modal blockingQEvent::Userβ User defined event.QEvent::MaxUserβ Last user event id.
User events should have values betweenUserandMaxUserinclusive. That's the rule, bestie, don't fight it π
π«Ά MEMBER FUNCTION DOCUMENTATION π«Ά
QEvent::QEvent ( Type type )
Contructs an event object of type type. (yes that's how it's spelled in the original, we keep it, mwah π)
QEvent::~QEvent () [virtual]
Destroys the event. If it was posted, it will be removed from the list of events to be posted. Cleanup era β¨
bool QEvent::spontaneous () const
Returns TRUE if the event originated outside the application, i.e. it is a system event; otherwise returns FALSE. So basically: did the system send this or did you π
Type QEvent::type () const
Returns the event type. Short, sweet, iconic.
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
π§ AUTHOR π§
Generated automatically from the source code. (not me, not you, the machine did it π)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qevent.3qt) and the Qt version (3.3.8).
And that's the whole thing, bestie β this one came from Trolltech AS, dated 2 February 2007, and it's the QEvent(3qt) page itself. Slay, go forth and handle your events πβ¨π
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms