📄 qcontextmenuevent.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qevent.cpp:1420 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QContextMenuEvent Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td 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="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QContextMenuEvent Class Reference</h1><p>The QContextMenuEvent class contains parameters that describe a context menu event.<a href="#details">More...</a><p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt><p>Inherits <a href="qevent.html">QEvent</a>.<p><a href="qcontextmenuevent-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>enum <a href="#Reason-enum"><b>Reason</b></a> { Mouse, Keyboard, Other }</div></li><li><div class=fn><a href="#QContextMenuEvent"><b>QContextMenuEvent</b></a> ( Reason reason, const QPoint & pos, const QPoint & globalPos, int state )</div></li><li><div class=fn><a href="#QContextMenuEvent-2"><b>QContextMenuEvent</b></a> ( Reason reason, const QPoint & pos, int state )</div></li><li><div class=fn>int <a href="#x"><b>x</b></a> () const</div></li><li><div class=fn>int <a href="#y"><b>y</b></a> () const</div></li><li><div class=fn>int <a href="#globalX"><b>globalX</b></a> () const</div></li><li><div class=fn>int <a href="#globalY"><b>globalY</b></a> () const</div></li><li><div class=fn>const QPoint & <a href="#pos"><b>pos</b></a> () const</div></li><li><div class=fn>const QPoint & <a href="#globalPos"><b>globalPos</b></a> () const</div></li><li><div class=fn>ButtonState <a href="#state"><b>state</b></a> () const</div></li><li><div class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</div></li><li><div class=fn>bool <a href="#isConsumed"><b>isConsumed</b></a> () const</div></li><li><div class=fn>void <a href="#consume"><b>consume</b></a> ()</div></li><li><div class=fn>void <a href="#accept"><b>accept</b></a> ()</div></li><li><div class=fn>void <a href="#ignore"><b>ignore</b></a> ()</div></li><li><div class=fn>Reason <a href="#reason"><b>reason</b></a> () const</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QContextMenuEvent class contains parameters that describe a context menu event.<p> <p> Context menu events are sent to widgets when a user triggers acontext menu. What triggers this is platform dependent. Forexample, on Windows, pressing the menu button or releasing theright mouse button will cause this event to be sent.<p> When this event occurs it is customary to show a <a href="qpopupmenu.html">QPopupMenu</a> with acontext menu, if this is relevant to the context.<p> Context menu events contain a special accept flag that indicateswhether the receiver accepted the event. If the event handler doesnot accept the event, then whatever triggered the event will behandled as a regular input event if possible.<p> <p>See also <a href="qpopupmenu.html">QPopupMenu</a> and <a href="events.html">Event Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="Reason-enum"></a>QContextMenuEvent::Reason</h3><p> This enum describes the reason the ContextMenuEvent was sent. Thevalues are:<ul><li><tt>QContextMenuEvent::Mouse</tt> - The mouse caused the event to be sent. Normally thismeans the right mouse button was clicked, but this is platformspecific.<li><tt>QContextMenuEvent::Keyboard</tt> - The keyboard caused this event to be sent. OnWindows this means the menu button was pressed.<li><tt>QContextMenuEvent::Other</tt> - The event was sent by some other means (i.e. not bythe mouse or keyboard).</ul><hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QContextMenuEvent"></a>QContextMenuEvent::QContextMenuEvent ( <a href="qcontextmenuevent.html#Reason-enum">Reason</a> reason, const <a href="qpoint.html">QPoint</a> & pos, const <a href="qpoint.html">QPoint</a> & globalPos, int state )</h3><p> Constructs a context menu event object with the accept parameterflag set to FALSE.<p> The <em>reason</em> parameter must be <a href="#Reason-enum">QContextMenuEvent::Mouse</a> or <a href="#Reason-enum">QContextMenuEvent::Keyboard</a>.<p> The <em>pos</em> parameter specifies the mouse position relative to thereceiving widget. <em>globalPos</em> is the mouse position in absolutecoordinates. <em>state</em> is the ButtonState at the time of the event.<h3 class=fn><a name="QContextMenuEvent-2"></a>QContextMenuEvent::QContextMenuEvent ( <a href="qcontextmenuevent.html#Reason-enum">Reason</a> reason, const <a href="qpoint.html">QPoint</a> & pos, int state )</h3><p> Constructs a context menu event object with the accept parameterflag set to FALSE.<p> The <em>reason</em> parameter must be <a href="#Reason-enum">QContextMenuEvent::Mouse</a> or <a href="#Reason-enum">QContextMenuEvent::Keyboard</a>.<p> The <em>pos</em> parameter specifies the mouse position relative to thereceiving widget. <em>state</em> is the ButtonState at the time of theevent.<p> The <a href="#globalPos">globalPos</a>() is initialized to <a href="qcursor.html#pos">QCursor::pos</a>(), which may not beappropriate. Use the other constructor to specify the globalposition explicitly.<h3 class=fn>void <a name="accept"></a>QContextMenuEvent::accept ()</h3><p> Sets the accept flag of the context event object.<p> Setting the accept flag indicates that the receiver of this eventhas processed the event. Processing the event means you didsomething with it and it will be implicitly consumed.<p> The accept flag is not set by default.<p> <p>See also <a href="#ignore">ignore</a>() and <a href="#consume">consume</a>().<h3 class=fn>void <a name="consume"></a>QContextMenuEvent::consume ()</h3><p> Sets the consume flag of the context event object.<p> Setting the consume flag indicates that the receiver of this eventdoes not want the event to be propagated further (i.e. not sent toparent classes.)<p> The consumed flag is not set by default.<p> <p>See also <a href="#ignore">ignore</a>() and <a href="#accept">accept</a>().<h3 class=fn>const <a href="qpoint.html">QPoint</a> & <a name="globalPos"></a>QContextMenuEvent::globalPos () const</h3><p> Returns the global position of the mouse pointer at the time ofthe event.<p> <p>See also <a href="#x">x</a>(), <a href="#y">y</a>() and <a href="#pos">pos</a>().<h3 class=fn>int <a name="globalX"></a>QContextMenuEvent::globalX () const</h3><p> Returns the global x-position of the mouse pointer at the time ofthe event.<p> <p>See also <a href="#globalY">globalY</a>() and <a href="#globalPos">globalPos</a>().<h3 class=fn>int <a name="globalY"></a>QContextMenuEvent::globalY () const</h3><p> Returns the global y-position of the mouse pointer at the time ofthe event.<p> <p>See also <a href="#globalX">globalX</a>() and <a href="#globalPos">globalPos</a>().<h3 class=fn>void <a name="ignore"></a>QContextMenuEvent::ignore ()</h3><p> Clears the accept flag of the context event object.<p> Clearing the accept flag indicates that the receiver of this eventdoes not need to show a context menu. This will implicitly removethe consumed flag as well.<p> The accept flag is not set by default.<p> <p>See also <a href="#accept">accept</a>() and <a href="#consume">consume</a>().<h3 class=fn>bool <a name="isAccepted"></a>QContextMenuEvent::isAccepted () const</h3><p> Returns TRUE if the receiver has processed the event; otherwisereturns FALSE.<p> <p>See also <a href="#accept">accept</a>(), <a href="#ignore">ignore</a>() and <a href="#consume">consume</a>().<h3 class=fn>bool <a name="isConsumed"></a>QContextMenuEvent::isConsumed () const</h3><p> Returns TRUE (which stops propagation of the event) if thereceiver has blocked the event; otherwise returns FALSE.<p> <p>See also <a href="#accept">accept</a>(), <a href="#ignore">ignore</a>() and <a href="#consume">consume</a>().<h3 class=fn>const <a href="qpoint.html">QPoint</a> & <a name="pos"></a>QContextMenuEvent::pos () const</h3><p> Returns the position of the mouse pointer relative to the widgetthat received the event.<p> <p>See also <a href="#x">x</a>(), <a href="#y">y</a>() and <a href="#globalPos">globalPos</a>().<h3 class=fn><a href="qcontextmenuevent.html#Reason-enum">Reason</a> <a name="reason"></a>QContextMenuEvent::reason () const</h3><p> Returns the reason for this context event.<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="state"></a>QContextMenuEvent::state () const</h3><p> Returns the button state (a combination of mouse buttons andkeyboard modifiers), i.e. what buttons and keys were beingpressed immediately before the event was generated.<p> The returned value is <a href="qt.html#ButtonState-enum">LeftButton</a>, <a href="qt.html#ButtonState-enum">RightButton</a>, <a href="qt.html#ButtonState-enum">MidButton</a>,<a href="qt.html#ButtonState-enum">ShiftButton</a>, <a href="qt.html#ButtonState-enum">ControlButton</a> and <a href="qt.html#ButtonState-enum">AltButton</a> OR'ed together.<h3 class=fn>int <a name="x"></a>QContextMenuEvent::x () const</h3><p> Returns the x-position of the mouse pointer, relative to thewidget that received the event.<p> <p>See also <a href="#y">y</a>() and <a href="#pos">pos</a>().<h3 class=fn>int <a name="y"></a>QContextMenuEvent::y () const</h3><p> Returns the y-position of the mouse pointer, relative to thewidget that received the event.<p> <p>See also <a href="#x">x</a>() and <a href="#pos">pos</a>().<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -