Sophie

Sophie

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

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" />
<!-- qgesturerecognizer.cpp -->
  <title>QGestureRecognizer Class | Qt Widgets 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="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGestureRecognizer</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-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#recognizing-gestures">Recognizing Gestures</a></li>
<li class="level2"><a href="#supporting-new-gestures">Supporting New Gestures</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QGestureRecognizer Class</h1>
<!-- $$$QGestureRecognizer-brief -->
<p>The <a href="qgesturerecognizer.html">QGestureRecognizer</a> class provides the infrastructure for gesture recognition. <a href="#details">More...</a></p>
<!-- @@@QGestureRecognizer -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGestureRecognizer&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.6</td></tr></table></div><ul>
<li><a href="qgesturerecognizer-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#ResultFlag-enum">Result</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#ResultFlag-enum">ResultFlag</a></b> { Ignore, MayBeGesture, TriggerGesture, FinishGesture, CancelGesture, ConsumeEventHint }</td></tr>
</table></div>
<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="qgesturerecognizer.html#QGestureRecognizer">QGestureRecognizer</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#dtor.QGestureRecognizer">~QGestureRecognizer</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QGesture *</td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#create">create</a></b>(QObject *<i>target</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Result </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#recognize">recognize</a></b>(QGesture *<i>gesture</i>, QObject *<i>watched</i>, QEvent *<i>event</i>) = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#reset">reset</a></b>(QGesture *<i>gesture</i>)</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Qt::GestureType </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#registerRecognizer">registerRecognizer</a></b>(QGestureRecognizer *<i>recognizer</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgesturerecognizer.html#unregisterRecognizer">unregisterRecognizer</a></b>(Qt::GestureType <i>type</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QGestureRecognizer-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qgesturerecognizer.html">QGestureRecognizer</a> class provides the infrastructure for gesture recognition.</p>
<p>Gesture recognizers are responsible for creating and managing <a href="qgesture.html">QGesture</a> objects and monitoring input events sent to <a href="qwidget.html">QWidget</a> and <a href="qgraphicsobject.html">QGraphicsObject</a> subclasses. <a href="qgesturerecognizer.html">QGestureRecognizer</a> is the base class for implementing custom gestures.</p>
<p>Developers that only need to provide gesture recognition for standard gestures do not need to use this class directly. Instances will be created behind the scenes by the framework.</p>
<p>For an overview of gesture handling in Qt and information on using gestures in your applications, see the <a href="gestures-overview.html">Gestures in Widgets and Graphics View</a> document.</p>
<a name="recognizing-gestures"></a>
<h3 >Recognizing Gestures</h3>
<p>The process of recognizing gestures involves filtering input events sent to specific objects, and modifying the associated <a href="qgesture.html">QGesture</a> objects to include relevant information about the user's input.</p>
<p>Gestures are created when the framework calls <a href="qgesturerecognizer.html#create">create</a>() to handle user input for a particular instance of a <a href="qwidget.html">QWidget</a> or <a href="qgraphicsobject.html">QGraphicsObject</a> subclass. A <a href="qgesture.html">QGesture</a> object is created for each widget or item that is configured to use gestures.</p>
<p>Once a <a href="qgesture.html">QGesture</a> has been created for a target object, the gesture recognizer will receive events for it in its <a href="qgesturerecognizer.html#recognize">recognize</a>() handler function.</p>
<p>When a gesture is canceled, the <a href="qgesturerecognizer.html#reset">reset</a>() function is called, giving the recognizer the chance to update the appropriate properties in the corresponding <a href="qgesture.html">QGesture</a> object.</p>
<a name="supporting-new-gestures"></a>
<h3 >Supporting New Gestures</h3>
<p>To add support for new gestures, you need to derive from <a href="qgesturerecognizer.html">QGestureRecognizer</a> to create a custom recognizer class, construct an instance of this class, and register it with the application by calling <a href="qgesturerecognizer.html#registerRecognizer">QGestureRecognizer::registerRecognizer</a>(). You can also subclass <a href="qgesture.html">QGesture</a> to create a custom gesture class, or rely on dynamic properties to express specific details of the gesture you want to handle.</p>
<p>Your custom <a href="qgesturerecognizer.html">QGestureRecognizer</a> subclass needs to reimplement the <a href="qgesturerecognizer.html#recognize">recognize</a>() function to handle and filter the incoming input events for <a href="qwidget.html">QWidget</a> and <a href="qgraphicsobject.html">QGraphicsObject</a> subclasses. Although the logic for gesture recognition is implemented in this function, you can store persistent information about the state of the recognition process in the <a href="qgesture.html">QGesture</a> object supplied. The <a href="qgesturerecognizer.html#recognize">recognize</a>() function must return a value of <a href="qgesturerecognizer.html#ResultFlag-enum">QGestureRecognizer::Result</a> that indicates the state of recognition for a given gesture and target object. This determines whether or not a gesture event will be delivered to a target object.</p>
<p>If you choose to represent a gesture by a custom <a href="qgesture.html">QGesture</a> subclass, you will need to reimplement the <a href="qgesturerecognizer.html#create">create</a>() function to construct instances of your gesture class. Similarly, you may need to reimplement the <a href="qgesturerecognizer.html#reset">reset</a>() function if your custom gesture objects need to be specially handled when a gesture is canceled.</p>
</div>
<p><b>See also </b><a href="qgesture.html">QGesture</a>.</p>
<!-- @@@QGestureRecognizer -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ResultFlag$$$Ignore$$$MayBeGesture$$$TriggerGesture$$$FinishGesture$$$CancelGesture$$$ResultState_Mask$$$ConsumeEventHint$$$ResultHint_Mask -->
<h3 class="flags" id="ResultFlag-enum"><a name="ResultFlag-enum"></a>enum QGestureRecognizer::<span class="name">ResultFlag</span><br/>flags QGestureRecognizer::<span class="name">Result</span></h3>
<p>This enum describes the result of the current event filtering step in a gesture recognizer state machine.</p>
<p>The result consists of a state value (one of Ignore, MayBeGesture, TriggerGesture, FinishGesture, CancelGesture) and an optional hint (ConsumeEventHint).</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::Ignore</code></td><td class="topAlign tblval"><code>0x0001</code></td><td class="topAlign">The event does not change the state of the recognizer.</td></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::MayBeGesture</code></td><td class="topAlign tblval"><code>0x0002</code></td><td class="topAlign">The event changed the internal state of the recognizer, but it isn't clear yet if it is a gesture or not. The recognizer needs to filter more events to decide. Gesture recognizers in the MayBeGesture state may be reset automatically if they take too long to recognize gestures.</td></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::TriggerGesture</code></td><td class="topAlign tblval"><code>0x0004</code></td><td class="topAlign">The gesture has been triggered and the appropriate <a href="qgesture.html">QGesture</a> object will be delivered to the target as a part of a <a href="qgestureevent.html">QGestureEvent</a>.</td></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::FinishGesture</code></td><td class="topAlign tblval"><code>0x0008</code></td><td class="topAlign">The gesture has been finished successfully and the appropriate <a href="qgesture.html">QGesture</a> object will be delivered to the target as a part of a <a href="qgestureevent.html">QGestureEvent</a>.</td></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::CancelGesture</code></td><td class="topAlign tblval"><code>0x0010</code></td><td class="topAlign">The event made it clear that it is not a gesture. If the gesture recognizer was in GestureTriggered state before, then the gesture is canceled and the appropriate <a href="qgesture.html">QGesture</a> object will be delivered to the target as a part of a <a href="qgestureevent.html">QGestureEvent</a>.</td></tr>
<tr><td class="topAlign"><code>QGestureRecognizer::ConsumeEventHint</code></td><td class="topAlign tblval"><code>0x0100</code></td><td class="topAlign">This hint specifies that the gesture framework should consume the filtered event and not deliver it to the receiver.</td></tr>
</table></div>
<p>The Result type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;ResultFlag&gt;. It stores an OR combination of ResultFlag values.</p>
<p><b>See also </b><a href="qgesturerecognizer.html#recognize">QGestureRecognizer::recognize</a>().</p>
<!-- @@@ResultFlag -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGestureRecognizer[overload1]$$$QGestureRecognizer -->
<h3 class="fn" id="QGestureRecognizer"><a name="QGestureRecognizer"></a>QGestureRecognizer::<span class="name">QGestureRecognizer</span>()</h3>
<p>Constructs a new gesture recognizer object.</p>
<!-- @@@QGestureRecognizer -->
<!-- $$$~QGestureRecognizer[overload1]$$$~QGestureRecognizer -->
<h3 class="fn" id="dtor.QGestureRecognizer"><a name="dtor.QGestureRecognizer"></a><code>[virtual] </code>QGestureRecognizer::<span class="name">~QGestureRecognizer</span>()</h3>
<p>Destroys the gesture recognizer.</p>
<!-- @@@~QGestureRecognizer -->
<!-- $$$create[overload1]$$$createQObject* -->
<h3 class="fn" id="create"><a name="create"></a><code>[virtual] </code><span class="type"><a href="qgesture.html">QGesture</a></span> *QGestureRecognizer::<span class="name">create</span>(<span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>target</i>)</h3>
<p>This function is called by Qt to create a new <a href="qgesture.html">QGesture</a> object for the given <i>target</i> (<a href="qwidget.html">QWidget</a> or <a href="qgraphicsobject.html">QGraphicsObject</a>).</p>
<p>Reimplement this function to create a custom <a href="qgesture.html">QGesture</a>-derived gesture object if necessary.</p>
<p>The application takes ownership of the created gesture object.</p>
<!-- @@@create -->
<!-- $$$recognize[overload1]$$$recognizeQGesture*QObject*QEvent* -->
<h3 class="fn" id="recognize"><a name="recognize"></a><code>[pure virtual] </code><span class="type"><a href="qgesturerecognizer.html#ResultFlag-enum">Result</a></span> QGestureRecognizer::<span class="name">recognize</span>(<span class="type"><a href="qgesture.html">QGesture</a></span> *<i>gesture</i>, <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> *<i>watched</i>, <span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> *<i>event</i>)</h3>
<p>Handles the given <i>event</i> for the <i>watched</i> object, updating the state of the <i>gesture</i> object as required, and returns a suitable result for the current recognition step.</p>
<p>This function is called by the framework to allow the recognizer to filter input events dispatched to <a href="qwidget.html">QWidget</a> or <a href="qgraphicsobject.html">QGraphicsObject</a> instances that it is monitoring.</p>
<p>The result reflects how much of the gesture has been recognized. The state of the <i>gesture</i> object is set depending on the result.</p>
<p><b>See also </b><a href="qgesturerecognizer.html#ResultFlag-enum">QGestureRecognizer::Result</a>.</p>
<!-- @@@recognize -->
<!-- $$$registerRecognizer[overload1]$$$registerRecognizerQGestureRecognizer* -->
<h3 class="fn" id="registerRecognizer"><a name="registerRecognizer"></a><code>[static] </code><span class="type"><a href="../qtcore/qt.html#GestureType-enum">Qt::GestureType</a></span> QGestureRecognizer::<span class="name">registerRecognizer</span>(<span class="type"><a href="qgesturerecognizer.html#QGestureRecognizer">QGestureRecognizer</a></span> *<i>recognizer</i>)</h3>
<p>Registers the given <i>recognizer</i> in the gesture framework and returns a gesture ID for it.</p>
<p>The application takes ownership of the <i>recognizer</i> and returns the gesture type ID associated with it. For gesture recognizers which handle custom <a href="qgesture.html">QGesture</a> objects (i.e&#x2e;, those which return <a href="../qtcore/qt.html#GestureType-enum">Qt::CustomGesture</a> in a <a href="qgesture.html#gestureType-prop">QGesture::gestureType</a>() function) the return value is a generated gesture ID with the <a href="../qtcore/qt.html#GestureType-enum">Qt::CustomGesture</a> flag set.</p>
<p><b>See also </b><a href="qgesturerecognizer.html#unregisterRecognizer">unregisterRecognizer</a>(), <a href="qgesturerecognizer.html#create">QGestureRecognizer::create</a>(), and <a href="qgesture.html">QGesture</a>.</p>
<!-- @@@registerRecognizer -->
<!-- $$$reset[overload1]$$$resetQGesture* -->
<h3 class="fn" id="reset"><a name="reset"></a><code>[virtual] </code><span class="type">void</span> QGestureRecognizer::<span class="name">reset</span>(<span class="type"><a href="qgesture.html">QGesture</a></span> *<i>gesture</i>)</h3>
<p>This function is called by the framework to reset a given <i>gesture</i>.</p>
<p>Reimplement this function to implement additional requirements for custom <a href="qgesture.html">QGesture</a> objects. This may be necessary if you implement a custom <a href="qgesture.html">QGesture</a> whose properties need special handling when the gesture is reset.</p>
<!-- @@@reset -->
<!-- $$$unregisterRecognizer[overload1]$$$unregisterRecognizerQt::GestureType -->
<h3 class="fn" id="unregisterRecognizer"><a name="unregisterRecognizer"></a><code>[static] </code><span class="type">void</span> QGestureRecognizer::<span class="name">unregisterRecognizer</span>(<span class="type"><a href="../qtcore/qt.html#GestureType-enum">Qt::GestureType</a></span> <i>type</i>)</h3>
<p>Unregisters all gesture recognizers of the specified <i>type</i>.</p>
<p><b>See also </b><a href="qgesturerecognizer.html#registerRecognizer">registerRecognizer</a>().</p>
<!-- @@@unregisterRecognizer -->
</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>