Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 1361

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qevent.cpp -->
  <title>QMouseEvent Class | Qt GUI 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QMouseEvent</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QMouseEvent Class</h1>
<!-- $$$QMouseEvent-brief -->
<p>The <a href="qmouseevent.html">QMouseEvent</a> class contains parameters that describe a mouse event. <a href="#details">More...</a></p>
<!-- @@@QMouseEvent -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QMouseEvent&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qinputevent.html">QInputEvent</a></td></tr></table></div><ul>
<li><a href="qmouseevent-members.html">List of all members, including inherited members</a></li>
<li><a href="qmouseevent-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#QMouseEvent">QMouseEvent</a></b>(Type <i>type</i>, const QPointF &amp;<i>localPos</i>, Qt::MouseButton <i>button</i>, Qt::MouseButtons <i>buttons</i>, Qt::KeyboardModifiers <i>modifiers</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#QMouseEvent-1">QMouseEvent</a></b>(Type <i>type</i>, const QPointF &amp;<i>localPos</i>, const QPointF &amp;<i>screenPos</i>, Qt::MouseButton <i>button</i>, Qt::MouseButtons <i>buttons</i>, Qt::KeyboardModifiers <i>modifiers</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#QMouseEvent-2">QMouseEvent</a></b>(Type <i>type</i>, const QPointF &amp;<i>localPos</i>, const QPointF &amp;<i>windowPos</i>, const QPointF &amp;<i>screenPos</i>, Qt::MouseButton <i>button</i>, Qt::MouseButtons <i>buttons</i>, Qt::KeyboardModifiers <i>modifiers</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#QMouseEvent-3">QMouseEvent</a></b>(Type <i>type</i>, const QPointF &amp;<i>localPos</i>, const QPointF &amp;<i>windowPos</i>, const QPointF &amp;<i>screenPos</i>, Qt::MouseButton <i>button</i>, Qt::MouseButtons <i>buttons</i>, Qt::KeyboardModifiers <i>modifiers</i>, Qt::MouseEventSource <i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::MouseButton </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#button">button</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::MouseButtons </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#buttons">buttons</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::MouseEventFlags </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#flags">flags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#globalPos">globalPos</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#globalX">globalX</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#globalY">globalY</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPointF &amp;</td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#localPos">localPos</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#pos">pos</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPointF &amp;</td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#screenPos">screenPos</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::MouseEventSource </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#source">source</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPointF &amp;</td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#windowPos">windowPos</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#x">x</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmouseevent.html#y">y</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">2 public functions inherited from <a href="qinputevent.html#public-functions">QInputEvent</a></li>
<li class="fn">6 public functions inherited from <a href="../qtcore/qevent.html#public-functions">QEvent</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qevent.html#properties">QEvent</a></li>
<li class="fn">1 static public member inherited from <a href="../qtcore/qevent.html#static-public-members">QEvent</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qevent.html#protected-variables">QEvent</a></li>
</ul>
<a name="details"></a>
<!-- $$$QMouseEvent-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qmouseevent.html">QMouseEvent</a> class contains parameters that describe a mouse event.</p>
<p>Mouse events occur when a mouse button is pressed or released inside a widget, or when the mouse cursor is moved.</p>
<p>Mouse move events will occur only when a mouse button is pressed down, unless mouse tracking has been enabled with <a href="../qtwidgets/qwidget.html#mouseTracking-prop">QWidget::setMouseTracking</a>().</p>
<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>
<p>A mouse event contains a special accept flag that indicates whether the receiver wants the event. You should call <a href="../qtcore/qevent.html#ignore">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="../qtcore/qevent.html#accept">accept</a>(), or an event filter consumes it.</p>
<p><b>Note: </b>If a mouse event is propagated to a <a href="../qtwidgets/qwidget.html">widget</a> for which <a href="../qtcore/qt.html#WidgetAttribute-enum">Qt::WA_NoMousePropagation</a> has been set, that mouse event will not be propagated further up the parent widget chain.</p><p>The state of the keyboard modifier keys can be found by calling the <a href="qinputevent.html#modifiers">modifiers()</a> function, inherited from <a href="qinputevent.html">QInputEvent</a>.</p>
<p>The functions <a href="qmouseevent.html#pos">pos</a>(), <a href="qmouseevent.html#x">x</a>(), and <a href="qmouseevent.html#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="qmouseevent.html#globalPos">globalPos</a>() to avoid a shaking motion.</p>
<p>The <a href="../qtwidgets/qwidget.html#enabled-prop">QWidget::setEnabled</a>() function can be used to enable or disable mouse and keyboard events for a widget.</p>
<p>Reimplement the <a href="../qtwidgets/qwidget.html">QWidget</a> event handlers, <a href="../qtwidgets/qwidget.html#mousePressEvent">QWidget::mousePressEvent</a>(), <a href="../qtwidgets/qwidget.html#mouseReleaseEvent">QWidget::mouseReleaseEvent</a>(), <a href="../qtwidgets/qwidget.html#mouseDoubleClickEvent">QWidget::mouseDoubleClickEvent</a>(), and <a href="../qtwidgets/qwidget.html#mouseMoveEvent">QWidget::mouseMoveEvent</a>() to receive mouse events in your own widgets.</p>
</div>
<p><b>See also </b><a href="../qtwidgets/qwidget.html#mouseTracking-prop">QWidget::setMouseTracking</a>(), <a href="../qtwidgets/qwidget.html#grabMouse">QWidget::grabMouse</a>(), and <a href="qcursor.html#pos">QCursor::pos</a>().</p>
<!-- @@@QMouseEvent -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QMouseEvent[overload1]$$$QMouseEventTypeconstQPointF&Qt::MouseButtonQt::MouseButtonsQt::KeyboardModifiers -->
<h3 class="fn" id="QMouseEvent"><a name="QMouseEvent"></a>QMouseEvent::<span class="name">QMouseEvent</span>(<span class="type"><a href="../qtcore/qevent.html#Type-enum">Type</a></span> <i>type</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>localPos</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a></span> <i>button</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButtons</a></span> <i>buttons</i>, <span class="type"><a href="../qtcore/qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> <i>modifiers</i>)</h3>
<p>Constructs a mouse event object.</p>
<p>The <i>type</i> parameter must be one of <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonPress</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonRelease</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonDblClick</a>, or <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseMove</a>.</p>
<p>The <i>localPos</i> is the mouse cursor's position relative to the receiving widget or item. The window position is set to the same value as <i>localPos</i>. The <i>button</i> that caused the event is given as a value from the <a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a> enum. If the event <i>type</i> is <a href="../qtcore/qevent.html#Type-enum">MouseMove</a>, the appropriate button for this event is <a href="../qtcore/qt.html#MouseButton-enum">Qt::NoButton</a>. The mouse and keyboard states at the time of the event are specified by <i>buttons</i> and <i>modifiers</i>.</p>
<p>The <a href="qmouseevent.html#screenPos">screenPos</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>
<!-- @@@QMouseEvent -->
<!-- $$$QMouseEvent$$$QMouseEventTypeconstQPointF&constQPointF&Qt::MouseButtonQt::MouseButtonsQt::KeyboardModifiers -->
<h3 class="fn" id="QMouseEvent-1"><a name="QMouseEvent-1"></a>QMouseEvent::<span class="name">QMouseEvent</span>(<span class="type"><a href="../qtcore/qevent.html#Type-enum">Type</a></span> <i>type</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>localPos</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>screenPos</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a></span> <i>button</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButtons</a></span> <i>buttons</i>, <span class="type"><a href="../qtcore/qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> <i>modifiers</i>)</h3>
<p>Constructs a mouse event object.</p>
<p>The <i>type</i> parameter must be <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonPress</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonRelease</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonDblClick</a>, or <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseMove</a>.</p>
<p>The <i>localPos</i> is the mouse cursor's position relative to the receiving widget or item. The cursor's position in screen coordinates is specified by <i>screenPos</i>. The window position is set to the same value as <i>localPos</i>. The <i>button</i> that caused the event is given as a value from the <a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a> enum. If the event <i>type</i> is <a href="../qtcore/qevent.html#Type-enum">MouseMove</a>, the appropriate button for this event is <a href="../qtcore/qt.html#MouseButton-enum">Qt::NoButton</a>. <i>buttons</i> is the state of all buttons at the time of the event, <i>modifiers</i> the state of all keyboard modifiers.</p>
<!-- @@@QMouseEvent -->
<!-- $$$QMouseEvent$$$QMouseEventTypeconstQPointF&constQPointF&constQPointF&Qt::MouseButtonQt::MouseButtonsQt::KeyboardModifiers -->
<h3 class="fn" id="QMouseEvent-2"><a name="QMouseEvent-2"></a>QMouseEvent::<span class="name">QMouseEvent</span>(<span class="type"><a href="../qtcore/qevent.html#Type-enum">Type</a></span> <i>type</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>localPos</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>windowPos</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>screenPos</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a></span> <i>button</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButtons</a></span> <i>buttons</i>, <span class="type"><a href="../qtcore/qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> <i>modifiers</i>)</h3>
<p>Constructs a mouse event object.</p>
<p>The <i>type</i> parameter must be <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonPress</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonRelease</a>, <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseButtonDblClick</a>, or <a href="../qtcore/qevent.html#Type-enum">QEvent::MouseMove</a>.</p>
<p>The points <i>localPos</i>, <i>windowPos</i> and <i>screenPos</i> specify the mouse cursor's position relative to the receiving widget or item, window, and screen, respectively.</p>
<p>The <i>button</i> that caused the event is given as a value from the <a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a> enum. If the event <i>type</i> is <a href="../qtcore/qevent.html#Type-enum">MouseMove</a>, the appropriate button for this event is <a href="../qtcore/qt.html#MouseButton-enum">Qt::NoButton</a>. <i>buttons</i> is the state of all buttons at the time of the event, <i>modifiers</i> the state of all keyboard modifiers.</p>
<!-- @@@QMouseEvent -->
<!-- $$$QMouseEvent$$$QMouseEventTypeconstQPointF&constQPointF&constQPointF&Qt::MouseButtonQt::MouseButtonsQt::KeyboardModifiersQt::MouseEventSource -->
<h3 class="fn" id="QMouseEvent-3"><a name="QMouseEvent-3"></a>QMouseEvent::<span class="name">QMouseEvent</span>(<span class="type"><a href="../qtcore/qevent.html#Type-enum">Type</a></span> <i>type</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>localPos</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>windowPos</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>screenPos</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a></span> <i>button</i>, <span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButtons</a></span> <i>buttons</i>, <span class="type"><a href="../qtcore/qt.html#KeyboardModifier-enum">Qt::KeyboardModifiers</a></span> <i>modifiers</i>, <span class="type"><a href="../qtcore/qt.html#MouseEventSource-enum">Qt::MouseEventSource</a></span> <i>source</i>)</h3>
<p>Default constructs an instance of QMouseEvent.</p><!-- @@@QMouseEvent -->
<!-- $$$button[overload1]$$$button -->
<h3 class="fn" id="button"><a name="button"></a><span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a></span> QMouseEvent::<span class="name">button</span>() const</h3>
<p>Returns the button that caused the event.</p>
<p>Note that the returned value is always <a href="../qtcore/qt.html#MouseButton-enum">Qt::NoButton</a> for mouse move events.</p>
<p><b>See also </b><a href="qmouseevent.html#buttons">buttons</a>() and <a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a>.</p>
<!-- @@@button -->
<!-- $$$buttons[overload1]$$$buttons -->
<h3 class="fn" id="buttons"><a name="buttons"></a><span class="type"><a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButtons</a></span> QMouseEvent::<span class="name">buttons</span>() const</h3>
<p>Returns the button state when the event was generated. The button state is a combination of <a href="../qtcore/qt.html#MouseButton-enum">Qt::LeftButton</a>, <a href="../qtcore/qt.html#MouseButton-enum">Qt::RightButton</a>, <a href="../qtcore/qt.html#MouseButton-enum">Qt::MidButton</a> using the OR operator. For mouse move events, this is all buttons that are pressed down. For mouse press and double click events this includes the button that caused the event. For mouse release events this excludes the button that caused the event.</p>
<p><b>See also </b><a href="qmouseevent.html#button">button</a>() and <a href="../qtcore/qt.html#MouseButton-enum">Qt::MouseButton</a>.</p>
<!-- @@@buttons -->
<!-- $$$flags[overload1]$$$flags -->
<h3 class="fn" id="flags"><a name="flags"></a><span class="type"><a href="../qtcore/qt.html#MouseEventFlag-enum">Qt::MouseEventFlags</a></span> QMouseEvent::<span class="name">flags</span>() const</h3>
<p>Returns the mouse event flags.</p>
<p>The mouse event flags provide additional information about a mouse event.</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="../qtcore/qt.html#MouseEventFlag-enum">Qt::MouseEventFlag</a> and <a href="../qtwidgets/qgraphicsscenemouseevent.html#flags">QGraphicsSceneMouseEvent::flags</a>().</p>
<!-- @@@flags -->
<!-- $$$globalPos[overload1]$$$globalPos -->
<h3 class="fn" id="globalPos"><a name="globalPos"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QMouseEvent::<span class="name">globalPos</span>() const</h3>
<p>Returns the global position of the mouse cursor <i>at the time of the event</i>. This is important on asynchronous window systems like X11. Whenever you move your widgets around in response to mouse events, globalPos() may differ a lot from the current pointer position <a href="qcursor.html#pos">QCursor::pos</a>(), and from <a href="../qtwidgets/qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>(<a href="qmouseevent.html#pos">pos</a>()).</p>
<p><b>See also </b><a href="qmouseevent.html#globalX">globalX</a>() and <a href="qmouseevent.html#globalY">globalY</a>().</p>
<!-- @@@globalPos -->
<!-- $$$globalX[overload1]$$$globalX -->
<h3 class="fn" id="globalX"><a name="globalX"></a><span class="type">int</span> QMouseEvent::<span class="name">globalX</span>() const</h3>
<p>Returns the global x position of the mouse cursor at the time of the event.</p>
<p><b>See also </b><a href="qmouseevent.html#globalY">globalY</a>() and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>
<!-- @@@globalX -->
<!-- $$$globalY[overload1]$$$globalY -->
<h3 class="fn" id="globalY"><a name="globalY"></a><span class="type">int</span> QMouseEvent::<span class="name">globalY</span>() const</h3>
<p>Returns the global y position of the mouse cursor at the time of the event.</p>
<p><b>See also </b><a href="qmouseevent.html#globalX">globalX</a>() and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>
<!-- @@@globalY -->
<!-- $$$localPos[overload1]$$$localPos -->
<h3 class="fn" id="localPos"><a name="localPos"></a>const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;QMouseEvent::<span class="name">localPos</span>() const</h3>
<p>Returns the position of the mouse cursor as a <a href="../qtcore/qpointf.html">QPointF</a>, relative to the widget or item that received the event.</p>
<p>If you move the widget as a result of the mouse event, use the screen position returned by <a href="qmouseevent.html#screenPos">screenPos</a>() to avoid a shaking motion.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), <a href="qmouseevent.html#windowPos">windowPos</a>(), and <a href="qmouseevent.html#screenPos">screenPos</a>().</p>
<!-- @@@localPos -->
<!-- $$$pos[overload1]$$$pos -->
<h3 class="fn" id="pos"><a name="pos"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QMouseEvent::<span class="name">pos</span>() const</h3>
<p>Returns the position of the mouse cursor, relative to the widget that received the event.</p>
<p>If you move the widget as a result of the mouse event, use the global position returned by <a href="qmouseevent.html#globalPos">globalPos</a>() to avoid a shaking motion.</p>
<p><b>See also </b><a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), and <a href="qmouseevent.html#globalPos">globalPos</a>().</p>
<!-- @@@pos -->
<!-- $$$screenPos[overload1]$$$screenPos -->
<h3 class="fn" id="screenPos"><a name="screenPos"></a>const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;QMouseEvent::<span class="name">screenPos</span>() const</h3>
<p>Returns the position of the mouse cursor as a <a href="../qtcore/qpointf.html">QPointF</a>, relative to the screen that received the event.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), <a href="qmouseevent.html#pos">pos</a>(), <a href="qmouseevent.html#localPos">localPos</a>(), and <a href="qmouseevent.html#windowPos">windowPos</a>().</p>
<!-- @@@screenPos -->
<!-- $$$source[overload1]$$$source -->
<h3 class="fn" id="source"><a name="source"></a><span class="type"><a href="../qtcore/qt.html#MouseEventSource-enum">Qt::MouseEventSource</a></span> QMouseEvent::<span class="name">source</span>() const</h3>
<p>Returns information about the mouse event source.</p>
<p>The mouse event source can be used to distinguish between genuine and artificial mouse events. The latter are events that are synthesized from touch events by the operating system or Qt itself.</p>
<p><b>Note: </b>Many platforms provide no such information. On such platforms <a href="../qtcore/qt.html#MouseEventSource-enum">Qt::MouseEventNotSynthesized</a> is returned always.</p><p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="../qtcore/qt.html#MouseEventSource-enum">Qt::MouseEventSource</a> and <a href="../qtwidgets/qgraphicsscenemouseevent.html#source">QGraphicsSceneMouseEvent::source</a>().</p>
<!-- @@@source -->
<!-- $$$windowPos[overload1]$$$windowPos -->
<h3 class="fn" id="windowPos"><a name="windowPos"></a>const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;QMouseEvent::<span class="name">windowPos</span>() const</h3>
<p>Returns the position of the mouse cursor as a <a href="../qtcore/qpointf.html">QPointF</a>, relative to the window that received the event.</p>
<p>If you move the widget as a result of the mouse event, use the global position returned by <a href="qmouseevent.html#globalPos">globalPos</a>() to avoid a shaking motion.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qmouseevent.html#x">x</a>(), <a href="qmouseevent.html#y">y</a>(), <a href="qmouseevent.html#pos">pos</a>(), <a href="qmouseevent.html#localPos">localPos</a>(), and <a href="qmouseevent.html#screenPos">screenPos</a>().</p>
<!-- @@@windowPos -->
<!-- $$$x[overload1]$$$x -->
<h3 class="fn" id="x"><a name="x"></a><span class="type">int</span> QMouseEvent::<span class="name">x</span>() const</h3>
<p>Returns the x position of the mouse cursor, relative to the widget that received the event.</p>
<p><b>See also </b><a href="qmouseevent.html#y">y</a>() and <a href="qmouseevent.html#pos">pos</a>().</p>
<!-- @@@x -->
<!-- $$$y[overload1]$$$y -->
<h3 class="fn" id="y"><a name="y"></a><span class="type">int</span> QMouseEvent::<span class="name">y</span>() const</h3>
<p>Returns the y position of the mouse cursor, relative to the widget that received the event.</p>
<p><b>See also </b><a href="qmouseevent.html#x">x</a>() and <a href="qmouseevent.html#pos">pos</a>().</p>
<!-- @@@y -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>