.BI "enum \fBReason\fR { Mouse, Keyboard, Other }"
.br
.ti -1c
.BI "\fBQContextMenuEvent\fR ( Reason reason, const QPoint & pos, const QPoint & globalPos, int state )"
.br
.ti -1c
.BI "\fBQContextMenuEvent\fR ( Reason reason, const QPoint & pos, int state )"
.br
.ti -1c
.BI "int \fBx\fR () const"
.br
.ti -1c
.BI "int \fBy\fR () const"
.br
.ti -1c
.BI "int \fBglobalX\fR () const"
.br
.ti -1c
.BI "int \fBglobalY\fR () const"
.br
.ti -1c
.BI "const QPoint & \fBpos\fR () const"
.br
.ti -1c
.BI "const QPoint & \fBglobalPos\fR () const"
.br
.ti -1c
.BI "ButtonState \fBstate\fR () const"
.br
.ti -1c
.BI "bool \fBisAccepted\fR () const"
.br
.ti -1c
.BI "bool \fBisConsumed\fR () const"
.br
.ti -1c
.BI "void \fBconsume\fR ()"
.br
.ti -1c
.BI "void \fBaccept\fR ()"
.br
.ti -1c
.BI "void \fBignore\fR ()"
.br
.ti -1c
.BI "Reason \fBreason\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QContextMenuEvent class contains parameters that describe a context menu event.
.PP
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.
.PP
When this event occurs it is customary to show a QPopupMenu with a context menu, if this is relevant to the context.
.PP
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.
.PP
See also QPopupMenu and Event Classes.
.SS "Member Type Documentation"
.SH "QContextMenuEvent::Reason"
This enum describes the reason the ContextMenuEvent was sent. The values are:
.TP
\fCQContextMenuEvent::Mouse\fR - The mouse caused the event to be sent. Normally this means the right mouse button was clicked, but this is platform specific.
.TP
\fCQContextMenuEvent::Keyboard\fR - The keyboard caused this event to be sent. On Windows this means the menu button was pressed.
.TP
\fCQContextMenuEvent::Other\fR - The event was sent by some other means (i.e. not by the mouse or keyboard).
.SH MEMBER FUNCTION DOCUMENTATION
.SH "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.
.PP
The \fIreason\fR parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.
.PP
The \fIpos\fR parameter specifies the mouse position relative to the receiving widget. \fIglobalPos\fR is the mouse position in absolute coordinates. \fIstate\fR is the ButtonState at the time of the event.
.SH "QContextMenuEvent::QContextMenuEvent ( Reason reason, const QPoint & pos, int state )"
Constructs a context menu event object with the accept parameter flag set to FALSE.
.PP
The \fIreason\fR parameter must be QContextMenuEvent::Mouse or QContextMenuEvent::Keyboard.
.PP
The \fIpos\fR parameter specifies the mouse position relative to the receiving widget. \fIstate\fR is the ButtonState at the time of the event.
.PP
The globalPos() is initialized to QCursor::pos(), which may not be appropriate. Use the other constructor to specify the global position explicitly.
.SH "void QContextMenuEvent::accept ()"
Sets the accept flag of the context event object.
.PP
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.
.PP
The accept flag is not set by default.
.PP
See also ignore() and consume().
.SH "void QContextMenuEvent::consume ()"
Sets the consume flag of the context event object.
.PP
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.)
Returns the global position of the mouse pointer at the time of the event.
.PP
See also x(), y(), and pos().
.SH "int QContextMenuEvent::globalX () const"
Returns the global x-position of the mouse pointer at the time of the event.
.PP
See also globalY() and globalPos().
.SH "int QContextMenuEvent::globalY () const"
Returns the global y-position of the mouse pointer at the time of the event.
.PP
See also globalX() and globalPos().
.SH "void QContextMenuEvent::ignore ()"
Clears the accept flag of the context event object.
.PP
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.
.PP
The accept flag is not set by default.
.PP
See also accept() and consume().
.SH "bool QContextMenuEvent::isAccepted () const"
Returns TRUE if the receiver has processed the event; otherwise returns FALSE.
.PP
See also accept(), ignore(), and consume().
.SH "bool QContextMenuEvent::isConsumed () const"
Returns TRUE (which stops propagation of the event) if the receiver has blocked the event; otherwise returns FALSE.
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.
.PP
The returned value is LeftButton, RightButton, MidButton, ShiftButton, ControlButton and AltButton OR'ed together.
.SH "int QContextMenuEvent::x () const"
Returns the x-position of the mouse pointer, relative to the widget that received the event.
.PP
See also y() and pos().
.SH "int QContextMenuEvent::y () const"
Returns the y-position of the mouse pointer, relative to the widget that received the event.