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  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Fonctions  · 

QContextMenuEvent Class Reference

The QContextMenuEvent class contains parameters that describe a context menu event. More...

#include <qevent.h>

Inherits QEvent.

List of all member functions.

Public Members


Detailed Description

The QContextMenuEvent class contains parameters that describe a context menu event.

Context menu events are sent to widgets when a user triggers a context menu. What triggers this is platform dependent. For example, on Windows, pressing the menu button or releasing the right mouse button will cause this event to be sent.

When this event occurs it is customary to show a QPopupMenu with a context menu, if this is relevant to the context.

Context menu events contain a special accept flag that indicates whether the receiver accepted the event. If the event handler does not accept the event, then whatever triggered the event will be handled as a regular input event if possible.

See also QPopupMenu and Event Classes.


Member Type Documentation

QContextMenuEvent::Reason

This enum describes the reason the ContextMenuEvent was sent. The values are:

  • QContextMenuEvent::Mouse - The mouse caused the event to be sent. Normally this means the right mouse button was clicked, but this is platform specific.
  • QContextMenuEvent::Keyboard - The keyboard caused this event to be sent. On Windows this means the menu button was pressed.
  • QContextMenuEvent::Other - The event was sent by some other means (i.e. not by the mouse or keyboard).

Member Function Documentation

QContextMenuEvent::QContextMenuEvent ( Reason reason, const QPoint & pos, const QPoint & globalPos, int state )

Constructs a context menu event object with the accept parameter flag set to FALSE.

The reason parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.

The pos parameter specifies the mouse position relative to the receiving widget. globalPos is the mouse position in absolute coordinates. state is the ButtonState at the time of the event.

QContextMenuEvent::QContextMenuEvent ( Reason reason, const QPoint & pos, int state )

Constructs a context menu event object with the accept parameter flag set to FALSE.

The reason parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.

The pos parameter specifies the mouse position relative to the receiving widget. state is the ButtonState at the time of the event.

The globalPos() is initialized to QCursor::pos(), which may not be appropriate. Use the other constructor to specify the global position explicitly.

void QContextMenuEvent::accept ()

Sets the accept flag of the context event object.

Setting the accept flag indicates that the receiver of this event has processed the event. Processing the event means you did something with it and it will be implicitly consumed.

The accept flag is not set by default.

See also ignore() and consume().

void QContextMenuEvent::consume ()

Sets the consume flag of the context event object.

Setting the consume flag indicates that the receiver of this event does not want the event to be propagated further (i.e. not sent to parent classes.)

The consumed flag is not set by default.

See also ignore() and accept().

const QPoint & QContextMenuEvent::globalPos () const

Returns the global position of the mouse pointer at the time of the event.

See also x(), y(), and pos().

int QContextMenuEvent::globalX () const

Returns the global x-position of the mouse pointer at the time of the event.

See also globalY() and globalPos().

int QContextMenuEvent::globalY () const

Returns the global y-position of the mouse pointer at the time of the event.

See also globalX() and globalPos().

void QContextMenuEvent::ignore ()

Clears the accept flag of the context event object.

Clearing the accept flag indicates that the receiver of this event does not need to show a context menu. This will implicitly remove the consumed flag as well.

The accept flag is not set by default.

See also accept() and consume().

bool QContextMenuEvent::isAccepted () const

Returns TRUE if the receiver has processed the event; otherwise returns FALSE.

See also accept(), ignore(), and consume().

bool QContextMenuEvent::isConsumed () const

Returns TRUE (which stops propagation of the event) if the receiver has blocked the event; otherwise returns FALSE.

See also accept(), ignore(), and consume().

const QPoint & QContextMenuEvent::pos () const

Returns the position of the mouse pointer relative to the widget that received the event.

See also x(), y(), and globalPos().

Reason QContextMenuEvent::reason () const

Returns the reason for this context event.

ButtonState QContextMenuEvent::state () const

Returns the button state (a combination of mouse buttons and keyboard modifiers), i.e. what buttons and keys were being pressed immediately before the event was generated.

The returned value is LeftButton, RightButton, MidButton, ShiftButton, ControlButton and AltButton OR'ed together.

int QContextMenuEvent::x () const

Returns the x-position of the mouse pointer, relative to the widget that received the event.

See also y() and pos().

int QContextMenuEvent::y () const

Returns the y-position of the mouse pointer, relative to the widget that received the event.

See also x() and pos().


This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 85
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 19
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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 3.2
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