1QContextMenuEvent(3qt) QContextMenuEvent(3qt)
2
3
4
6 QContextMenuEvent - Parameters that describe a context menu event
7
9 #include <qevent.h>
10
11 Inherits QEvent.
12
13 Public Members
14 enum Reason { Mouse, Keyboard, Other }
15 QContextMenuEvent ( Reason reason, const QPoint & pos, const QPoint &
16 globalPos, int state )
17 QContextMenuEvent ( Reason reason, const QPoint & pos, int state )
18 int x () const
19 int y () const
20 int globalX () const
21 int globalY () const
22 const QPoint & pos () const
23 const QPoint & globalPos () const
24 ButtonState state () const
25 bool isAccepted () const
26 bool isConsumed () const
27 void consume ()
28 void accept ()
29 void ignore ()
30 Reason reason () const
31
33 The QContextMenuEvent class contains parameters that describe a context
34 menu event.
35
36 Context menu events are sent to widgets when a user triggers a context
37 menu. What triggers this is platform dependent. For example, on
38 Windows, pressing the menu button or releasing the right mouse button
39 will cause this event to be sent.
40
41 When this event occurs it is customary to show a QPopupMenu with a
42 context menu, if this is relevant to the context.
43
44 Context menu events contain a special accept flag that indicates
45 whether the receiver accepted the event. If the event handler does not
46 accept the event, then whatever triggered the event will be handled as
47 a regular input event if possible.
48
49 See also QPopupMenu and Event Classes.
50
51 Member Type Documentation
53 This enum describes the reason the ContextMenuEvent was sent. The
54 values are:
55
56 QContextMenuEvent::Mouse - The mouse caused the event to be sent.
57 Normally this means the right mouse button was clicked, but this is
58 platform specific.
59
60 QContextMenuEvent::Keyboard - The keyboard caused this event to be
61 sent. On Windows this means the menu button was pressed.
62
63 QContextMenuEvent::Other - The event was sent by some other means (i.e.
64 not by the mouse or keyboard).
65
68 const QPoint & globalPos, int state )
69 Constructs a context menu event object with the accept parameter flag
70 set to FALSE.
71
72 The reason parameter must be QContextMenuEvent::Mouse or
73 QContextMenuEvent::Keyboard.
74
75 The pos parameter specifies the mouse position relative to the
76 receiving widget. globalPos is the mouse position in absolute
77 coordinates. state is the ButtonState at the time of the event.
78
80 state )
81 Constructs a context menu event object with the accept parameter flag
82 set to FALSE.
83
84 The reason parameter must be QContextMenuEvent::Mouse or
85 QContextMenuEvent::Keyboard.
86
87 The pos parameter specifies the mouse position relative to the
88 receiving widget. state is the ButtonState at the time of the event.
89
90 The globalPos() is initialized to QCursor::pos(), which may not be
91 appropriate. Use the other constructor to specify the global position
92 explicitly.
93
95 Sets the accept flag of the context event object.
96
97 Setting the accept flag indicates that the receiver of this event has
98 processed the event. Processing the event means you did something with
99 it and it will be implicitly consumed.
100
101 The accept flag is not set by default.
102
103 See also ignore() and consume().
104
106 Sets the consume flag of the context event object.
107
108 Setting the consume flag indicates that the receiver of this event does
109 not want the event to be propagated further (i.e. not sent to parent
110 classes.)
111
112 The consumed flag is not set by default.
113
114 See also ignore() and accept().
115
117 Returns the global position of the mouse pointer at the time of the
118 event.
119
120 See also x(), y(), and pos().
121
123 Returns the global x-position of the mouse pointer at the time of the
124 event.
125
126 See also globalY() and globalPos().
127
129 Returns the global y-position of the mouse pointer at the time of the
130 event.
131
132 See also globalX() and globalPos().
133
135 Clears the accept flag of the context event object.
136
137 Clearing the accept flag indicates that the receiver of this event does
138 not need to show a context menu. This will implicitly remove the
139 consumed flag as well.
140
141 The accept flag is not set by default.
142
143 See also accept() and consume().
144
146 Returns TRUE if the receiver has processed the event; otherwise returns
147 FALSE.
148
149 See also accept(), ignore(), and consume().
150
152 Returns TRUE (which stops propagation of the event) if the receiver has
153 blocked the event; otherwise returns FALSE.
154
155 See also accept(), ignore(), and consume().
156
158 Returns the position of the mouse pointer relative to the widget that
159 received the event.
160
161 See also x(), y(), and globalPos().
162
164 Returns the reason for this context event.
165
167 Returns the button state (a combination of mouse buttons and keyboard
168 modifiers), i.e. what buttons and keys were being pressed immediately
169 before the event was generated.
170
171 The returned value is LeftButton, RightButton, MidButton, ShiftButton,
172 ControlButton and AltButton OR'ed together.
173
175 Returns the x-position of the mouse pointer, relative to the widget
176 that received the event.
177
178 See also y() and pos().
179
181 Returns the y-position of the mouse pointer, relative to the widget
182 that received the event.
183
184 See also x() and pos().
185
186
188 http://doc.trolltech.com/qcontextmenuevent.html
189 http://www.trolltech.com/faq/tech.html
190
192 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
193 license file included in the distribution for a complete license
194 statement.
195
197 Generated automatically from the source code.
198
200 If you find a bug in Qt, please report it as described in
201 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
202 help you. Thank you.
203
204 The definitive Qt documentation is provided in HTML format; it is
205 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
206 web browser. This man page is provided as a convenience for those users
207 who prefer man pages, although this format is not officially supported
208 by Trolltech.
209
210 If you find errors in this manual page, please report them to qt-
211 bugs@trolltech.com. Please include the name of the manual page
212 (qcontextmenuevent.3qt) and the Qt version (3.3.8).
213
214
215
216Trolltech AS 2 February 2007 QContextMenuEvent(3qt)