summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqcontextmenuevent.3qt
blob: 76678267d4b5021c38835e5f3eedecfba7df479f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
'\" t
.TH QContextMenuEvent 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QContextMenuEvent \- Parameters that describe a context menu event
.SH SYNOPSIS
\fC#include <ntqevent.h>\fR
.PP
Inherits QEvent.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.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.)
.PP
The consumed flag is not set by default.
.PP
See also ignore() and accept().
.SH "const QPoint & QContextMenuEvent::globalPos () const"
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.
.PP
See also accept(), ignore(), and consume().
.SH "const QPoint & QContextMenuEvent::pos () const"
Returns the position of the mouse pointer relative to the widget that received the event.
.PP
See also x(), y(), and globalPos().
.SH "Reason QContextMenuEvent::reason () const"
Returns the reason for this context event.
.SH "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.
.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.
.PP
See also x() and pos().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/qcontextmenuevent.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
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. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqcontextmenuevent.3qt) and the Qt
version (3.3.8).