Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 6e2327ca1c896c6d674ae53117299f21 > files > 1106

qtdeclarative5-doc-5.12.6-1.mga7.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" />
<!-- qquickpointhandler.cpp -->
  <title>PointHandler QML Type | Qt Quick 5.12.6</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.12</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >PointHandler QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.6 Reference Documentation</a></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="#properties">Properties</a></li>
<li class="level1"><a href="#signals">Signals</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">PointHandler QML Type</h1>
<span class="subtitle"></span>
<!-- $$$PointHandler-brief -->
<p>Handler for reacting to a single touchpoint. <a href="#details">More...</a></p>
<!-- @@@PointHandler -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-singlepointhandler.html">SinglePointHandler</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-pointhandler-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#acceptedButtons-prop">acceptedButtons</a></b></b> : flags</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#acceptedDevices-prop">acceptedDevices</a></b></b> : flags</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#acceptedModifiers-prop">acceptedModifiers</a></b></b> : flags</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#acceptedPointerTypes-prop">acceptedPointerTypes</a></b></b> : flags</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#active-prop">active</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#enabled-prop">enabled</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#grabPermissions-prop">grabPermissions</a></b></b> : flags</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#margin-prop">margin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#parent-prop">parent</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#point-prop">point</a></b></b> : HandlerPoint</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#target-prop">target</a></b></b> : Item</li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#canceled-signal">canceled</a></b></b>(EventPoint <i>point</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-pointhandler.html#grabChanged-signal">grabChanged</a></b></b>(GrabTransition <i>transition</i>,  EventPoint <i>point</i>)</li>
</ul>
<!-- $$$PointHandler-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p><a href="qml-qtquick-pointhandler.html">PointHandler</a> can be used to show feedback about a touchpoint or the mouse position, or to otherwise react to pointer events.</p>
<p>When a press event occurs, each instance of <a href="qml-qtquick-pointhandler.html">PointHandler</a> chooses a single point which is not yet &quot;taken&quot; at that moment: if the press occurs within the bounds of the <a href="qml-qtquick-pointhandler.html#parent-prop">PointerHandler::parent</a>, and no sibling <a href="qml-qtquick-pointhandler.html">PointHandler</a> within the same <a href="qml-qtquick-pointhandler.html#parent-prop">PointerHandler::parent</a> has yet acquired a passive grab on that point, and if the other constraints such as <a href="qml-qtquick-pointhandler.html#acceptedButtons-prop">acceptedButtons</a>, <a href="qml-qtquick-pointhandler.html#acceptedDevices-prop">acceptedDevices</a> etc. are satisfied, it's eligible, and the <a href="qml-qtquick-pointhandler.html">PointHandler</a> then acquires a passive grab. In this way, the <a href="qml-qtquick-pointhandler.html#parent-prop">PointerHandler::parent</a> acts like an exclusive group: there can be multiple instances of <a href="qml-qtquick-pointhandler.html">PointHandler</a>, and the set of pressed touchpoints will be distributed among them. Each <a href="qml-qtquick-pointhandler.html">PointHandler</a> which has chosen a point to track has its active property <code>true</code>. It then continues to track its chosen point until release: the properties of the point will be kept up-to-date. Any Item can bind to these properties, and thereby follow the point's movements.</p>
<p>By being only a passive grabber, it has the ability to keep independent oversight of all movements. The passive grab cannot be stolen or overridden even when other gestures are detected and exclusive grabs occur.</p>
<p>If your goal is orthogonal surveillance of eventpoints, an older alternative was QObject::installEventFilter(), but that has never been a built-in <a href="qtquick-module.html">QtQuick</a> feature: it requires some C++ code, such as a <a href="qquickitem.html">QQuickItem</a> subclass. <a href="qml-qtquick-pointhandler.html">PointHandler</a> is more efficient than that, because only pointer events will be delivered to it, during the course of normal event delivery in <a href="qquickwindow.html">QQuickWindow</a>; whereas an event filter needs to filter all QEvents of all types, and thus sets itself up as a potential event delivery bottleneck.</p>
<p>One possible use case is to add this handler to a transparent Item which is on top of the rest of the scene (by having a high <a href="qml-qtquick-item.html#z-prop">z</a> value), so that when a point is freshly pressed, it will be delivered to that Item and its handlers first, providing the opportunity to take the passive grab as early as possible. Such an item (like a pane of glass over the whole UI) can be a convenient parent for other Items which visualize the kind of reactive feedback which must always be on top; and likewise it can be the parent for popups, popovers, dialogs and so on. If it will be used in that way, it can be helpful for your main.cpp to use QQmlContext::setContextProperty() to make the &quot;glass pane&quot; accessible by ID to the entire UI, so that other Items and PointHandlers can be reparented to it.</p>
<pre class="qml">

  import QtQuick 2.12
  import QtQuick.Window 2.2

  Window {
      width: 480
      height: 320
      visible: true

      Item {
          id: glassPane
          z: 10000
          anchors.fill: parent

          PointHandler {
              id: handler
              acceptedDevices: PointerDevice.TouchScreen | PointerDevice.TouchPad
              target: Rectangle {
                  parent: glassPane
                  color: "red"
                  visible: handler.active
                  x: handler.point.position.x - width / 2
                  y: handler.point.position.y - height / 2
                  width: 20; height: width; radius: width / 2
              }
          }
      }
  }

</pre>
<p>Like all input handlers, a <a href="qml-qtquick-pointhandler.html">PointHandler</a> has a target property, which may be used as a convenient place to put a point-tracking Item; but <a href="qml-qtquick-pointhandler.html">PointHandler</a> will not automatically manipulate the <code>target</code> item in any way. You need to use bindings to make it react to the point.</p>
<p><b>Note: </b>On macOS, <a href="qml-qtquick-pointhandler.html">PointHandler</a> does not react to the trackpad by default. That is because macOS can provide either native gesture recognition, or raw touchpoints, but not both. We prefer to use the native gesture event in <a href="qml-qtquick-pinchhandler.html">PinchHandler</a>, so we do not want to disable it by enabling touch. However <a href="qml-qtquick-multipointtoucharea.html">MultiPointTouchArea</a> does enable touch, thus disabling native gesture recognition within the entire window; so it's an alternative if you only want to react to all the touchpoints but do not require the smooth native-gesture experience.</p><p><b>See also </b><a href="qml-qtquick-multipointtoucharea.html">MultiPointTouchArea</a>.</p>
<!-- @@@PointHandler -->
<h2>Property Documentation</h2>
<!-- $$$acceptedButtons -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="acceptedButtons-prop">
<td class="tblQmlPropNode"><p>
<a name="acceptedButtons-prop"></a><span class="name">acceptedButtons</span> : <span class="type">flags</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The mouse buttons which can activate this Pointer Handler.</p>
<p>By default, this property is set to <a href="qml-qtquick-mouseevent.html#button-prop">Qt.LeftButton</a>. It can be set to an OR combination of mouse buttons, and will ignore events from other buttons.</p>
<p>For example, a control could be made to respond to left and right clicks in different ways, with two handlers:</p>
<pre class="qml">



</pre>
<p><b>Note: </b>Tapping on a touchscreen or tapping the stylus on a graphics tablet emulates clicking the left mouse button. This behavior can be altered via <a href="qml-qtquick-pointhandler.html#acceptedDevices-prop">acceptedDevices</a> or <a href="qml-qtquick-pointhandler.html#acceptedPointerTypes-prop">acceptedPointerTypes</a>.</p></div></div><!-- @@@acceptedButtons -->
<br/>
<!-- $$$acceptedDevices -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="acceptedDevices-prop">
<td class="tblQmlPropNode"><p>
<a name="acceptedDevices-prop"></a><span class="name">acceptedDevices</span> : <span class="type">flags</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The types of pointing devices that can activate this Pointer Handler.</p>
<p>By default, this property is set to <a href="qml-qtquick-pointerdevice.html#type-prop">PointerDevice.AllDevices</a>. If you set it to an OR combination of device types, it will ignore events from non-matching devices.</p>
<p>For example, a control could be made to respond to mouse and stylus clicks in one way, and touchscreen taps in another way, with two handlers:</p>
<pre class="qml">



</pre>
</div></div><!-- @@@acceptedDevices -->
<br/>
<!-- $$$acceptedModifiers -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="acceptedModifiers-prop">
<td class="tblQmlPropNode"><p>
<a name="acceptedModifiers-prop"></a><span class="name">acceptedModifiers</span> : <span class="type">flags</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If this property is set, it will require the given keyboard modifiers to be pressed in order to react to pointer events, and otherwise ignore them.</p>
<p>If this property is set to <code>Qt.KeyboardModifierMask</code> (the default value), then the <a href="qml-qtquick-pointerhandler.html">PointerHandler</a> ignores the modifier keys.</p>
<p>For example, an <a href="qml-qtquick-item.html">Item</a> could have two handlers of the same type, one of which is enabled only if the required keyboard modifiers are pressed:</p>
<pre class="qml">



</pre>
</div></div><!-- @@@acceptedModifiers -->
<br/>
<!-- $$$acceptedPointerTypes -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="acceptedPointerTypes-prop">
<td class="tblQmlPropNode"><p>
<a name="acceptedPointerTypes-prop"></a><span class="name">acceptedPointerTypes</span> : <span class="type">flags</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The types of pointing instruments (finger, stylus, eraser, etc.) that can activate this Pointer Handler.</p>
<p>By default, this property is set to <a href="qml-qtquick-pointerdevice.html#pointerType-prop">PointerDevice.AllPointerTypes</a>. If you set it to an OR combination of device types, it will ignore events from non-matching events.</p>
<p>For example, a control could be made to respond to mouse, touch, and stylus clicks in some way, but delete itself if tapped with an eraser tool on a graphics tablet, with two handlers:</p>
<pre class="qml">



</pre>
</div></div><!-- @@@acceptedPointerTypes -->
<br/>
<!-- $$$active -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="active-prop">
<td class="tblQmlPropNode"><p>
<a name="active-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">active</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This holds true whenever this Input Handler has taken sole responsibility for handing one or more EventPoints, by successfully taking an exclusive grab of those points. This means that it is keeping its properties up-to-date according to the movements of those Event Points and actively manipulating its <a href="qml-qtquick-pointhandler.html#target-prop">target</a> (if any).</p>
</div></div><!-- @@@active -->
<br/>
<!-- $$$enabled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="enabled-prop">
<td class="tblQmlPropNode"><p>
<a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If a <a href="qml-qtquick-pointerhandler.html">PointerHandler</a> is disabled, it will reject all events and no signals will be emitted.</p>
</div></div><!-- @@@enabled -->
<br/>
<!-- $$$grabPermissions -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="grabPermissions-prop">
<td class="tblQmlPropNode"><p>
<a name="grabPermissions-prop"></a><span class="name">grabPermissions</span> : <span class="type">flags</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property specifies the permissions when this handler's logic decides to take over the exclusive grab, or when it is asked to approve grab takeover or cancellation by another handler.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>PointerHandler.TakeOverForbidden</code></td><td class="topAlign">This handler neither takes from nor gives grab permission to any type of Item or Handler.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.CanTakeOverFromHandlersOfSameType</code></td><td class="topAlign">This handler can take the exclusive grab from another handler of the same class.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.CanTakeOverFromHandlersOfDifferentType</code></td><td class="topAlign">This handler can take the exclusive grab from any kind of handler.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.CanTakeOverFromAnything</code></td><td class="topAlign">This handler can take the exclusive grab from any type of Item or Handler.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.ApprovesTakeOverByHandlersOfSameType</code></td><td class="topAlign">This handler gives permission for another handler of the same class to take the grab.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.ApprovesTakeOverByHandlersOfDifferentType</code></td><td class="topAlign">This handler gives permission for any kind of handler to take the grab.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.ApprovesTakeOverByItems</code></td><td class="topAlign">This handler gives permission for any kind of Item to take the grab.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.ApprovesCancellation</code></td><td class="topAlign">This handler will allow its grab to be set to null.</td></tr>
<tr><td class="topAlign"><code>PointerHandler.ApprovesTakeOverByAnything</code></td><td class="topAlign">This handler gives permission for any any type of Item or Handler to take the grab.</td></tr>
</table></div>
<p>The default is <code>PointerHandler.CanTakeOverFromItems | PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything</code> which allows most takeover scenarios but avoids e.g&#x2e; two PinchHandlers fighting over the same touchpoints.</p>
</div></div><!-- @@@grabPermissions -->
<br/>
<!-- $$$margin -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="margin-prop">
<td class="tblQmlPropNode"><p>
<a name="margin-prop"></a><span class="name">margin</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The margin beyond the bounds of the <a href="qml-qtquick-pointhandler.html#parent-prop">parent</a> item within which an event point can activate this handler. For example, on a <a href="qml-qtquick-pinchhandler.html">PinchHandler</a> where the <a href="qml-qtquick-pointhandler.html#target-prop">target</a> is also the <code>parent</code>, it's useful to set this to a distance at least half the width of a typical user's finger, so that if the <code>parent</code> has been scaled down to a very small size, the pinch gesture is still possible. Or, if a <a href="qml-qtquick-taphandler.html">TapHandler</a>-based button is placed near the screen edge, it can be used to comply with Fitts's Law: react to mouse clicks at the screen edge even though the button is visually spaced away from the edge by a few pixels.</p>
<p>The default value is 0.</p>
<p class="centerAlign"><img src="images/pointerHandlerMargin.png" alt="" /></p></div></div><!-- @@@margin -->
<br/>
<!-- $$$parent -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="parent-prop">
<td class="tblQmlPropNode"><p>
<a name="parent-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">parent</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <a href="qml-qtquick-item.html">Item</a> which is the scope of the handler; the Item in which it was declared. The handler will handle events on behalf of this Item, which means a pointer event is relevant if at least one of its event points occurs within the Item's interior. Initially <a href="qml-qtquick-pointhandler.html#target-prop">target()</a> is the same, but it can be reassigned.</p>
<p><b>See also </b><a href="qml-qtquick-pointhandler.html#target-prop">target</a> and QObject::parent().</p>
</div></div><!-- @@@parent -->
<br/>
<!-- $$$point -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="point-prop">
<td class="tblQmlPropNode"><p>
<a name="point-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">point</span> : <span class="type"><a href="qml-qtquick-handlerpoint.html">HandlerPoint</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The event point currently being handled. When no point is currently being handled, this object is reset to default values (all coordinates are 0).</p>
</div></div><!-- @@@point -->
<br/>
<!-- $$$target -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="target-prop">
<td class="tblQmlPropNode"><p>
<a name="target-prop"></a><span class="name">target</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The Item which this handler will manipulate.</p>
<p>By default, it is the same as the <a href="qml-qtquick-pointhandler.html#parent-prop">parent</a>, the Item within which the handler is declared. However, it can sometimes be useful to set the target to a different Item, in order to handle events within one item but manipulate another; or to <code>null</code>, to disable the default behavior and do something else instead.</p>
</div></div><!-- @@@target -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$canceled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="canceled-signal">
<td class="tblQmlFuncNode"><p>
<a name="canceled-signal"></a><span class="name">canceled</span>(<span class="type"><a href="qml-qtquick-eventpoint.html">EventPoint</a></span> <i>point</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If this handler has already grabbed the given <i>point</i>, this signal is emitted when the grab is stolen by a different Pointer Handler or Item.</p>
</div></div><!-- @@@canceled -->
<br/>
<!-- $$$grabChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="grabChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="grabChanged-signal"></a><span class="name">grabChanged</span>(<span class="type">GrabTransition</span> <i>transition</i>,  <span class="type"><a href="qml-qtquick-eventpoint.html">EventPoint</a></span> <i>point</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the grab has changed in some way which is relevant to this handler.</p>
<p>The <i>transition</i> (verb) tells what happened. The <i>point</i> (object) is the point that was grabbed or ungrabbed.</p>
</div></div><!-- @@@grabChanged -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 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>