Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Tous les espaces de nom  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QEvent Class Reference
[QtCore module]

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

 #include <QEvent>

Inherited by QAccessibleEvent, QActionEvent, QChildEvent, QCloseEvent, QCustomEvent, QDragLeaveEvent, QDropEvent, QDynamicPropertyChangeEvent, QFileOpenEvent, QFocusEvent, QGraphicsSceneEvent, QHelpEvent, QHideEvent, QHoverEvent, QIconDragEvent, QInputEvent, QInputMethodEvent, QMoveEvent, QPaintEvent, QResizeEvent, QShortcutEvent, QShowEvent, QStatusTipEvent, QTimerEvent, QWhatsThisClickedEvent, and QWindowStateChangeEvent.

Public Types

  • enum Type { None, AccessibilityDescription, AccessibilityHelp, AccessibilityPrepare, ..., MaxUser }

Properties

Public Functions


Detailed Description

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 QObjects.

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).

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(), QWidget::event(), QCoreApplication::sendEvent(), QCoreApplication::postEvent(), and QCoreApplication::processEvents().


Member Type Documentation

enum QEvent::Type

This enum type defines the valid event types in Qt. The event types and the specialized classes for each type are as follows:

ConstantValueDescription
QEvent::None0Not an event.
QEvent::AccessibilityDescription130Used to query accessibility description texts (QAccessibleEvent).
QEvent::AccessibilityHelp119Used to query accessibility help texts (QAccessibleEvent).
QEvent::AccessibilityPrepare86Accessibility information is requested.
QEvent::ActionAdded114A new action has been added (QActionEvent).
QEvent::ActionChanged113An action has been changed (QActionEvent).
QEvent::ActionRemoved115An action has been removed (QActionEvent).
QEvent::ActivationChange99A widget's top-level window activation state has changed.
QEvent::ApplicationActivate121The application has been made available to the user.
QEvent::ApplicationActivatedApplicationActivateThis enum has been deprecated. Use ApplicationActivate instead.
QEvent::ApplicationDeactivate122The application has been suspended, and is unavailable to the user.
QEvent::ApplicationFontChange36The default application font has changed.
QEvent::ApplicationLayoutDirectionChange37The default application layout direction has changed.
QEvent::ApplicationPaletteChange38The default application palette has changed.
QEvent::ApplicationWindowIconChange35The application's icon has changed.
QEvent::ChildAdded68An object gets a child (QChildEvent).
QEvent::ChildInserted70An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead.
QEvent::ChildPolished69A widget child gets polished (QChildEvent).
QEvent::ChildRemoved71An object loses a child (QChildEvent).
QEvent::Clipboard40The clipboard contents have changed (QClipboardEvent).
QEvent::Close19Widget was closed (QCloseEvent).
QEvent::ContentsRectChange178The margins of the widget's content rect changed.
QEvent::ContextMenu82Context popup menu (QContextMenuEvent).
QEvent::DeferredDelete52The object will be deleted after it has cleaned up.
QEvent::DragEnter60The cursor enters a widget during a drag and drop operation (QDragEnterEvent).
QEvent::DragLeave62The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent).
QEvent::DragMove61A drag and drop operation is in progress (QDragMoveEvent).
QEvent::Drop63A drag and drop operation is completed (QDropEvent).
QEvent::EnabledChange98Widget's enabled state has changed.
QEvent::Enter10Mouse enters widget's boundaries.
QEvent::EnterEditFocus150An editor widget gains focus for editing.
QEvent::EnterWhatsThisMode124Send to toplevel widgets when the application enters "What's This?" mode.
QEvent::FileOpen116File open request (QFileOpenEvent).
QEvent::FocusIn8Widget gains keyboard focus (QFocusEvent).
QEvent::FocusOut9Widget loses keyboard focus (QFocusEvent).
QEvent::FontChange97Widget's font has changed.
QEvent::GraphicsSceneContextMenu159Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent).
QEvent::GraphicsSceneDragEnter164The cursor enters a graphics scene during a drag and drop operation.
QEvent::GraphicsSceneDragLeave166The cursor leaves a graphics scene during a drag and drop operation.
QEvent::GraphicsSceneDragMove165A drag and drop operation is in progress over a scene.
QEvent::GraphicsSceneDrop167A drag and drop operation is completed over a scene.
QEvent::GraphicsSceneHelp163The user requests help for a graphics scene (QHelpEvent).
QEvent::GraphicsSceneHoverEnter160The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent).
QEvent::GraphicsSceneHoverLeave162The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent).
QEvent::GraphicsSceneHoverMove161The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent).
QEvent::GraphicsSceneMouseDoubleClick158Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent).
QEvent::GraphicsSceneMouseMove155Move mouse in a graphics scene (QGraphicsSceneMouseEvent).
QEvent::GraphicsSceneMousePress156Mouse press in a graphics scene (QGraphicsSceneMouseEvent).
QEvent::GraphicsSceneMouseRelease157Mouse release in a graphics scene (QGraphicsSceneMouseEvent).
QEvent::GraphicsSceneWheel168Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent).
QEvent::Hide18Widget was hidden (QHideEvent).
QEvent::HideToParent27A child widget has been hidden.
QEvent::HoverEnter127The mouse cursor enters a hover widget (QHoverEvent).
QEvent::HoverLeave128The mouse cursor leaves a hover widget (QHoverEvent).
QEvent::HoverMove129The mouse cursor moves inside a hover widget (QHoverEvent).
QEvent::IconDrag96The main icon of a window has been dragged away (QIconDragEvent).
QEvent::IconTextChange101Widget's icon text has been changed.
QEvent::InputMethod83An input method is being used (QInputMethodEvent).
QEvent::KeyPress6Key press (QKeyEvent).
QEvent::KeyRelease7Key release (QKeyEvent).
QEvent::LanguageChange89The application translation changed.
QEvent::LayoutDirectionChange90The direction of layouts changed.
QEvent::LayoutRequest76Widget layout needs to be redone.
QEvent::Leave11Mouse leaves widget's boundaries.
QEvent::LeaveEditFocus151An editor widget loses focus for editing.
QEvent::LeaveWhatsThisMode125Send to toplevel widgets when the application leaves "What's This?" mode.
QEvent::LocaleChange88The system locale has changed.
QEvent::NonClientAreaMouseButtonDblClick176A mouse double click occurred outside the client area.
QEvent::NonClientAreaMouseButtonPress174A mouse button press occurred outside the client area.
QEvent::NonClientAreaMouseButtonRelease175A mouse button release occurred outside the client area.
QEvent::NonClientAreaMouseMove173A mouse move occurred outside the client area.
QEvent::MacSizeChange177The user changed his widget sizes (Mac OS X only).
QEvent::MenubarUpdated153The window's menu bar has been updated.
QEvent::MetaCall43An asynchronous method invocation via QMetaObject::invokeMethod().
QEvent::ModifiedChange102Widgets modification state has been changed.
QEvent::MouseButtonDblClick4Mouse press again (QMouseEvent).
QEvent::MouseButtonPress2Mouse press (QMouseEvent).
QEvent::MouseButtonRelease3Mouse release (QMouseEvent).
QEvent::MouseMove5Mouse move (QMouseEvent).
QEvent::MouseTrackingChange109The mouse tracking state has changed.
QEvent::Move13Widget's position changed (QMoveEvent).
QEvent::Paint12Screen update necessary (QPaintEvent).
QEvent::PaletteChange39Palette of the widget changed.
QEvent::ParentAboutToChange131The widget parent is about to change.
QEvent::ParentChange21The widget parent has changed.
QEvent::Polish75The widget is polished.
QEvent::PolishRequest74The widget should be polished.
QEvent::QueryWhatsThis123The widget should accept the event if it has "What's This?" help.
QEvent::Resize14Widget's size changed (QResizeEvent).
QEvent::Shortcut117Key press in child for shortcut key handling (QShortcutEvent).
QEvent::ShortcutOverride51Key press in child, for overriding shortcut key handling (QKeyEvent).
QEvent::Show17Widget was shown on screen (QShowEvent).
QEvent::ShowToParent26A child widget has been shown.
QEvent::SockAct50Socket activated, used to implement QSocketNotifier.
QEvent::StatusTip112A status tip is requested (QStatusTipEvent).
QEvent::StyleChange100Widget's style has been changed.
QEvent::TabletMove87Wacom tablet move (QTabletEvent).
QEvent::TabletPress92Wacom tablet press (QTabletEvent).
QEvent::TabletRelease93Wacom tablet release (QTabletEvent).
QEvent::TabletEnterProximity171Wacom tablet enter proximity event (QTabletEvent), sent to QApplication.
QEvent::TabletLeaveProximity172Wacom tablet leave proximity event (QTabletEvent), sent to QApplication.
QEvent::Timer1Regular timer events (QTimerEvent).
QEvent::ToolBarChange120The toolbar button is toggled on Mac OS X.
QEvent::ToolTip110A tooltip was requested (QHelpEvent).
QEvent::UpdateLater78The widget should be queued to be repainted at a later time.
QEvent::UpdateRequest77The widget should be repainted.
QEvent::WhatsThis111The widget should reveal "What's This?" help (QHelpEvent).
QEvent::WhatsThisClicked118A link in a widget's "What's This?" help was clicked.
QEvent::Wheel31Mouse wheel rolled (QWheelEvent).
QEvent::WinEventAct132A Windows-specific activation event has occurred.
QEvent::WindowActivate24Window was activated.
QEvent::WindowBlocked103The window is blocked by a modal dialog.
QEvent::WindowDeactivate25Window was deactivated.
QEvent::WindowIconChange34The window's icon has changed.
QEvent::WindowStateChange105The window's state (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent).
QEvent::WindowTitleChange33The window title has changed.
QEvent::WindowUnblocked104The window is unblocked after a modal dialog exited.
QEvent::ZOrderChange126The widget's z-order has changed. This event is never sent to top level windows.
QEvent::KeyboardLayoutChange169The keyboard layout has changed.
QEvent::DynamicPropertyChange170A dynamic property was added, changed or removed from the object.

User events should have values between User and MaxUser:

ConstantValueDescription
QEvent::User1000User-defined event.
QEvent::MaxUser65535Last user event ID.


Property Documentation

accepted : bool

the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().

Access functions:

  • bool isAccepted () const
  • void setAccepted ( bool accepted )

Member Function Documentation

QEvent::QEvent ( Type type )

Contructs an event object of type type.

QEvent::~QEvent ()   [virtual]

Destroys the event. If it was posted, it will be removed from the list of events to be posted.

void QEvent::accept ()

Sets the accept flag of the event object, the equivalent of callign 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().

void QEvent::ignore ()

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 propgated to the parent widget.

See also accept().

bool QEvent::spontaneous () const

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

The return value of this function is not defined for paint events.

Type QEvent::type () const

Returns the event type.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 69
  2. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 27
  3. Une nouvelle ère d'IHM 3D pour les automobiles, un concept proposé par Digia et implémenté avec Qt 3
  4. Qt Creator 2.5 est sorti en beta, l'EDI supporte maintenant plus de fonctionnalités de C++11 2
  5. Vingt sociétés montrent leurs décodeurs basés sur Qt au IPTV World Forum, en en exploitant diverses facettes (déclaratif, Web, widgets) 0
  6. PySide devient un add-on Qt et rejoint le Qt Project et le modèle d'open gouvernance 1
  7. Thread travailleur avec Qt en utilisant les signaux et les slots, un article de Christophe Dumez traduit par Thibaut Cuvelier 1
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 101
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 51
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 69
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 27
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 229
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
  7. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 101
Page suivante

Le Qt Developer Network au hasard

Logo

Installation de PySide : binaires et compilation

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web