Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1559

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qevent.cpp:221 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QMouseEvent 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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>QMouseEvent Class Reference</h1>

<p>The QMouseEvent class contains parameters that describe a mouse event.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qevent-h.html">qevent.h</a>&gt;</tt>
<p>Inherits <a href="qevent.html">QEvent</a>.
<p><a href="qmouseevent-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QMouseEvent"><b>QMouseEvent</b></a> ( Type&nbsp;type, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, int&nbsp;button, int&nbsp;state )</div></li>
<li><div class=fn><a href="#QMouseEvent-2"><b>QMouseEvent</b></a> ( Type&nbsp;type, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, const&nbsp;QPoint&nbsp;&amp;&nbsp;globalPos, int&nbsp;button, int&nbsp;state )</div></li>
<li><div class=fn>const QPoint &amp; <a href="#pos"><b>pos</b></a> () const</div></li>
<li><div class=fn>const QPoint &amp; <a href="#globalPos"><b>globalPos</b></a> () const</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>ButtonState <a href="#button"><b>button</b></a> () const</div></li>
<li><div class=fn>ButtonState <a href="#state"><b>state</b></a> () const</div></li>
<li><div class=fn>ButtonState <a href="#stateAfter"><b>stateAfter</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</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>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



<p> The QMouseEvent class contains parameters that describe a mouse event.
<p> Mouse events occur when a mouse button is pressed or released inside a
widget or when the mouse cursor is moved.
<p> Mouse move events will occur only when a mouse button is pressed
down, unless mouse tracking has been enabled with
<a href="qwidget.html#setMouseTracking">QWidget::setMouseTracking</a>().
<p> Qt automatically grabs the mouse when a mouse button is pressed inside a
widget; the widget will continue to receive mouse events until the
last mouse button is released.
<p> A mouse event contains a special accept flag that indicates whether the
receiver wants the event.  You should call <a href="#ignore">QMouseEvent::ignore</a>() if the
mouse event is not handled by your widget. A mouse event is propagated up
the parent widget chain until a widget accepts it with <a href="#accept">QMouseEvent::accept</a>()
or an event filter consumes it.
<p> The functions <a href="#pos">pos</a>(), <a href="#x">x</a>() and <a href="#y">y</a>() give the cursor position relative
to the widget that receives the mouse event. If you move the widget
as a result of the mouse event, use the global position returned by
<a href="#globalPos">globalPos</a>() to avoid a shaking motion.
<p> The <a href="qwidget.html#setEnabled">QWidget::setEnabled</a>() function can be used to enable or disable mouse
and keyboard events for a widget.
<p> The event handlers <a href="qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>(), <a href="qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>(),
<a href="qwidget.html#mouseDoubleClickEvent">QWidget::mouseDoubleClickEvent</a>() and <a href="qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>() receive
mouse events.
<p> <p>See also <a href="qwidget.html#mouseTracking-prop">QWidget::mouseTracking</a>, <a href="qwidget.html#grabMouse">QWidget::grabMouse</a>(), <a href="qcursor.html#pos">QCursor::pos</a>() and <a href="events.html">Event Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QMouseEvent"></a>QMouseEvent::QMouseEvent ( <a href="qevent.html#Type-enum">Type</a>&nbsp;type, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, int&nbsp;button, int&nbsp;state )
</h3>

<p> Constructs a mouse event object.
<p> The <em>type</em> parameter must be one of <a href="qevent.html#Type-enum">QEvent::MouseButtonPress</a>,
<a href="qevent.html#Type-enum">QEvent::MouseButtonRelease</a>,
<a href="qevent.html#Type-enum">QEvent::MouseButtonDblClick</a> or <a href="qevent.html#Type-enum">QEvent::MouseMove</a>.
<p> The <em>pos</em> parameter specifies the position relative to the
receiving widget. <em>button</em> specifies the ButtonState of the button
that caused the event, which should be 0 if <em>type</em> is <a href="qevent.html#Type-enum">MouseMove</a>. <em>state</em> is the ButtonState at the time of the event.
<p> The <a href="#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.

<h3 class=fn><a name="QMouseEvent-2"></a>QMouseEvent::QMouseEvent ( <a href="qevent.html#Type-enum">Type</a>&nbsp;type, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;globalPos, int&nbsp;button, int&nbsp;state )
</h3>

<p> Constructs a mouse event object.
<p> The <em>type</em> parameter must be <a href="qevent.html#Type-enum">QEvent::MouseButtonPress</a>,
<a href="qevent.html#Type-enum">QEvent::MouseButtonRelease</a>,
<a href="qevent.html#Type-enum">QEvent::MouseButtonDblClick</a> or <a href="qevent.html#Type-enum">QEvent::MouseMove</a>.
<p> The <em>pos</em> parameter specifies the position relative to the
receiving widget. <em>globalPos</em> is the position in absolute
coordinates. <em>button</em> specifies the ButtonState of the button that
caused the event, which should be 0 if <em>type</em> is <a href="qevent.html#Type-enum">MouseMove</a>.
<em>state</em> is the ButtonState at the time of the event.

<h3 class=fn>void <a name="accept"></a>QMouseEvent::accept ()
</h3>

Sets the accept flag of the mouse event object.
<p> Setting the accept parameter indicates that the receiver of the event wants
the mouse event. Unwanted mouse events are sent to the parent widget.
<p> The accept flag is set by default.
<p> <p>See also <a href="#ignore">ignore</a>().

<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="button"></a>QMouseEvent::button () const
</h3>

Returns the button that caused the event.
<p> Possible return values are <a href="qt.html#ButtonState-enum">LeftButton</a>, <a href="qt.html#ButtonState-enum">RightButton</a>, <a href="qt.html#ButtonState-enum">MidButton</a> and
<a href="qt.html#ButtonState-enum">NoButton</a>.
<p> Note that the returned value is always <a href="qt.html#ButtonState-enum">NoButton</a> for mouse move
events.
<p> <p>See also <a href="#state">state</a>().

<p>Examples: <a href="dclock-example.html#x1763">dclock/dclock.cpp</a>, <a href="life-example.html#x1310">life/life.cpp</a> and <a href="t14.html#x2230">t14/cannon.cpp</a>.
<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="globalPos"></a>QMouseEvent::globalPos () const
</h3>

<p> Returns the global position of the mouse pointer <em>at the time</em> of
the event. This is important on asynchronous window systems like
X11. Whenever you move your widgets around in response to mouse
events, <a href="#globalPos">globalPos</a>() may differ a lot from the current pointer
position <a href="qcursor.html#pos">QCursor::pos</a>(), and from <a href="qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>( <a href="#pos">pos</a>() ).
<p> <p>See also <a href="#globalX">globalX</a>() and <a href="#globalY">globalY</a>().

<p>Example: <a href="aclock-example.html#x2057">aclock/aclock.cpp</a>.
<h3 class=fn>int <a name="globalX"></a>QMouseEvent::globalX () const
</h3>

Returns the global X position of the mouse pointer at the time of the event.
<p>See also <a href="#globalY">globalY</a>() and <a href="#globalPos">globalPos</a>().

<h3 class=fn>int <a name="globalY"></a>QMouseEvent::globalY () const
</h3>

Returns the global Y position of the mouse pointer at the time of the event.
<p>See also <a href="#globalX">globalX</a>() and <a href="#globalPos">globalPos</a>().

<h3 class=fn>void <a name="ignore"></a>QMouseEvent::ignore ()
</h3>

Clears the accept flag parameter of the mouse event object.
<p> Clearing the accept parameter indicates that the event receiver does
not want the mouse event. Unwanted mouse events are sent to the parent
widget.
<p> The accept flag is set by default.
<p> <p>See also <a href="#accept">accept</a>().

<h3 class=fn>bool <a name="isAccepted"></a>QMouseEvent::isAccepted () const
</h3>

Returns TRUE if the receiver of the event wants to keep the key;
otherwise returns FALSE.

<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="pos"></a>QMouseEvent::pos () const
</h3>

Returns the position of the mouse pointer relative to the widget that
received the event.
<p> If you move the widget as a result of the mouse event, use the
global position returned by <a href="#globalPos">globalPos</a>() to avoid a shaking motion.
<p> <p>See also <a href="#x">x</a>(), <a href="#y">y</a>() and <a href="#globalPos">globalPos</a>().

<p>Examples: <a href="drawlines-example.html#x1617">drawlines/connect.cpp</a>, <a href="life-example.html#x1311">life/life.cpp</a>, <a href="popup-example.html#x885">popup/popup.cpp</a>, <a href="qmag-example.html#x700">qmag/qmag.cpp</a>, <a href="scribble-example.html#x530">scribble/scribble.cpp</a>, <a href="t14.html#x2231">t14/cannon.cpp</a> and <a href="tooltip-example.html#x156">tooltip/tooltip.cpp</a>.
<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="state"></a>QMouseEvent::state () const
</h3>

<p> 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.
<p> Note that this means that for <a href="qevent.html#Type-enum">QEvent::MouseButtonPress</a> and <a href="qevent.html#Type-enum">QEvent::MouseButtonDblClick</a>, the flag for the <a href="#button">button</a>() itself will not be
set in the state, whereas for <a href="qevent.html#Type-enum">QEvent::MouseButtonRelease</a> it will.
<p> This value is mainly interesting for <a href="qevent.html#Type-enum">QEvent::MouseMove</a>; for the
other cases, button() is more useful.
<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.
<p> <p>See also <a href="#button">button</a>() and <a href="#stateAfter">stateAfter</a>().

<p>Examples: <a href="popup-example.html#x886">popup/popup.cpp</a> and <a href="showimg-example.html#x434">showimg/showimg.cpp</a>.
<h3 class=fn><a href="qt.html#ButtonState-enum">ButtonState</a> <a name="stateAfter"></a>QMouseEvent::stateAfter () const
</h3>

<p> Returns the state of buttons after the event.
<p> <p>See also <a href="#state">state</a>().

<h3 class=fn>int <a name="x"></a>QMouseEvent::x () const
</h3>

Returns the X position of the mouse pointer, relative to the widget that
received the event.
<p>See also <a href="#y">y</a>() and <a href="#pos">pos</a>().

<p>Example: <a href="showimg-example.html#x435">showimg/showimg.cpp</a>.
<h3 class=fn>int <a name="y"></a>QMouseEvent::y () const
</h3>

Returns the Y position of the mouse pointer, relative to the widget that
received the event.
<p>See also <a href="#x">x</a>() and <a href="#pos">pos</a>().

<p>Example: <a href="showimg-example.html#x436">showimg/showimg.cpp</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<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 &copy; 2001 
<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.2</div>
</table></div></address></body>
</html>