<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QContextMenuEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QContextMenuEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QContextMenuEvent class contains parameters that describe a context menu event. <a href="#details">More...</a></p> <p>Inherits <a href="qinputevent.html">QInputEvent</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qcontextmenuevent.html#Reason-enum">Reason</a></b> { Mouse, Keyboard, Other }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcontextmenuevent.html#QContextMenuEvent">__init__</a></b> (<i>self</i>, Reason <i>reason</i>, QPoint <i>pos</i>, QPoint <i>globalPos</i>, Qt.KeyboardModifiers <i>modifiers</i>)</li><li><div class="fn" /><b><a href="qcontextmenuevent.html#QContextMenuEvent-2">__init__</a></b> (<i>self</i>, Reason <i>reason</i>, QPoint <i>pos</i>, QPoint <i>globalPos</i>)</li><li><div class="fn" /><b><a href="qcontextmenuevent.html#QContextMenuEvent-3">__init__</a></b> (<i>self</i>, Reason <i>reason</i>, QPoint <i>pos</i>)</li><li><div class="fn" /><b><a href="qcontextmenuevent.html#QContextMenuEvent-4">__init__</a></b> (<i>self</i>, QContextMenuEvent)</li><li><div class="fn" />QPoint <b><a href="qcontextmenuevent.html#globalPos">globalPos</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcontextmenuevent.html#globalX">globalX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcontextmenuevent.html#globalY">globalY</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qcontextmenuevent.html#pos">pos</a></b> (<i>self</i>)</li><li><div class="fn" />Reason <b><a href="qcontextmenuevent.html#reason">reason</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcontextmenuevent.html#x">x</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qcontextmenuevent.html#y">y</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QContextMenuEvent class contains parameters that describe a context menu event.</p> <p>Context menu events are sent to widgets when a user performs an action associated with opening a context menu. The actions required to open context menus vary between platforms; for example, on Windows, pressing the menu button or clicking the right mouse button will cause this event to be sent.</p> <p>When this event occurs it is customary to show a <a href="qmenu.html">QMenu</a> with a context menu, if this is relevant to the context.</p> <p>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, if possible, whatever triggered the event will be handled as a regular input event.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Reason-enum" />QContextMenuEvent.Reason</h3><p>This enum describes the reason why the event was sent.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QContextMenuEvent.Mouse</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The mouse caused the event to be sent. Normally this means the right mouse button was clicked, but this is platform dependent.</td> </tr> <tr> <td class="topAlign"><tt>QContextMenuEvent.Keyboard</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The keyboard caused this event to be sent. On Windows, this means the menu button was pressed.</td> </tr> <tr> <td class="topAlign"><tt>QContextMenuEvent.Other</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">The event was sent by some other means (i.e. not by the mouse or keyboard).</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QContextMenuEvent" />QContextMenuEvent.__init__ (<i>self</i>, <a href="qcontextmenuevent.html#Reason-enum">Reason</a> <i>reason</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>, <a href="qpoint.html">QPoint</a> <i>globalPos</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a> <i>modifiers</i>)</h3><p>Constructs a context menu event object with the accept parameter flag set to false.</p> <p>The <i>reason</i> parameter must be <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Mouse</a> or <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Keyboard</a>.</p> <p>The <i>pos</i> parameter specifies the mouse position relative to the receiving widget. <i>globalPos</i> is the mouse position in absolute coordinates. The <i>modifiers</i> holds the keyboard modifiers.</p> <h3 class="fn"><a name="QContextMenuEvent-2" />QContextMenuEvent.__init__ (<i>self</i>, <a href="qcontextmenuevent.html#Reason-enum">Reason</a> <i>reason</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>, <a href="qpoint.html">QPoint</a> <i>globalPos</i>)</h3><p>Constructs a context menu event object with the accept parameter flag set to false.</p> <p>The <i>reason</i> parameter must be <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Mouse</a> or <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Keyboard</a>.</p> <p>The <i>pos</i> parameter specifies the mouse position relative to the receiving widget. <i>globalPos</i> is the mouse position in absolute coordinates.</p> <h3 class="fn"><a name="QContextMenuEvent-3" />QContextMenuEvent.__init__ (<i>self</i>, <a href="qcontextmenuevent.html#Reason-enum">Reason</a> <i>reason</i>, <a href="qpoint.html">QPoint</a> <i>pos</i>)</h3><p>Constructs a context menu event object with the accept parameter flag set to false.</p> <p>The <i>reason</i> parameter must be <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Mouse</a> or <a href="qcontextmenuevent.html#Reason-enum">QContextMenuEvent.Keyboard</a>.</p> <p>The <i>pos</i> parameter specifies the mouse position relative to the receiving widget.</p> <p>The <a href="qcontextmenuevent.html#globalPos">globalPos</a>() is initialized to <a href="qcursor.html#pos">QCursor.pos</a>(), which may not be appropriate. Use the other constructor to specify the global position explicitly.</p> <h3 class="fn"><a name="QContextMenuEvent-4" />QContextMenuEvent.__init__ (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a>)</h3><h3 class="fn"><a name="globalPos" /><a href="qpoint.html">QPoint</a> QContextMenuEvent.globalPos (<i>self</i>)</h3><p>Returns the global position of the mouse pointer at the time of the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#x">x</a>(), <a href="qcontextmenuevent.html#y">y</a>(), and <a href="qcontextmenuevent.html#pos">pos</a>().</p> <h3 class="fn"><a name="globalX" />int QContextMenuEvent.globalX (<i>self</i>)</h3><p>Returns the global x position of the mouse pointer at the time of the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#globalY">globalY</a>() and <a href="qcontextmenuevent.html#globalPos">globalPos</a>().</p> <h3 class="fn"><a name="globalY" />int QContextMenuEvent.globalY (<i>self</i>)</h3><p>Returns the global y position of the mouse pointer at the time of the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#globalX">globalX</a>() and <a href="qcontextmenuevent.html#globalPos">globalPos</a>().</p> <h3 class="fn"><a name="pos" /><a href="qpoint.html">QPoint</a> QContextMenuEvent.pos (<i>self</i>)</h3><p>Returns the position of the mouse pointer relative to the widget that received the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#x">x</a>(), <a href="qcontextmenuevent.html#y">y</a>(), and <a href="qcontextmenuevent.html#globalPos">globalPos</a>().</p> <h3 class="fn"><a name="reason" /><a href="qcontextmenuevent.html#Reason-enum">Reason</a> QContextMenuEvent.reason (<i>self</i>)</h3><p>Returns the reason for this context event.</p> <h3 class="fn"><a name="x" />int QContextMenuEvent.x (<i>self</i>)</h3><p>Returns the x position of the mouse pointer, relative to the widget that received the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#y">y</a>() and <a href="qcontextmenuevent.html#pos">pos</a>().</p> <h3 class="fn"><a name="y" />int QContextMenuEvent.y (<i>self</i>)</h3><p>Returns the y position of the mouse pointer, relative to the widget that received the event.</p> <p><b>See also</b> <a href="qcontextmenuevent.html#x">x</a>() and <a href="qcontextmenuevent.html#pos">pos</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>