<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qtapsensor.cpp --> <title>QTapReading Class | Qt Sensors 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="qtsensors-index.html">Qt Sensors</a></td><td ><a href="qtsensors-module.html">C++ Classes</a></td><td >QTapReading</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="#properties">Properties</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> <li class="level2"><a href="#qtapreading-units">QTapReading Units</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QTapReading Class</h1> <!-- $$$QTapReading-brief --> <p>The <a href="qtapreading.html">QTapReading</a> class represents one reading from the tap sensor. <a href="#details">More...</a></p> <!-- @@@QTapReading --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QTapReading></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += sensors</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qsensorreading.html">QSensorReading</a></td></tr></table></div><ul> <li><a href="qtapreading-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"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtapreading.html#TapDirection-enum">TapDirection</a></b> { Undefined, X, Y, Z, ..., Z_Both }</td></tr> </table></div> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><a href="qtapreading.html#doubleTap-prop">doubleTap</a></b> : const bool</li> <li class="fn"><b><a href="qtapreading.html#tapDirection-prop">tapDirection</a></b> : const TapDirection</li> </ul> <ul> <li class="fn">1 property inherited from <a href="qsensorreading.html#properties">QSensorReading</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"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtapreading.html#doubleTap-prop">isDoubleTap</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtapreading.html#setDoubleTap">setDoubleTap</a></b>(bool <i>doubleTap</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtapreading.html#setTapDirection">setTapDirection</a></b>(TapDirection <i>tapDirection</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> TapDirection </td><td class="memItemRight bottomAlign"><b><a href="qtapreading.html#tapDirection-prop">tapDirection</a></b>() const</td></tr> </table></div> <ul> <li class="fn">4 public functions inherited from <a href="qsensorreading.html#public-functions">QSensorReading</a></li> </ul> <a name="details"></a> <!-- $$$QTapReading-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qtapreading.html">QTapReading</a> class represents one reading from the tap sensor.</p> <a name="qtapreading-units"></a> <h4 >QTapReading Units</h4> <p>The tap sensor registers tap events along the 3 axes that originate from the phone. The axes are arranged as follows.</p> <p class="centerAlign"><img src="images/sensors-coordinates2.jpg" alt="" /></p><p>By default it returns only double tap events. The <a href="qtapsensor.html#returnDoubleTapEvents-prop">QTapSensor::returnDoubleTapEvents</a> property must be set to false to return individual tap events.</p> </div> <!-- @@@QTapReading --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$TapDirection$$$Undefined$$$X$$$Y$$$Z$$$X_Pos$$$Y_Pos$$$Z_Pos$$$X_Neg$$$Y_Neg$$$Z_Neg$$$X_Both$$$Y_Both$$$Z_Both --> <h3 class="fn" id="TapDirection-enum"><a name="TapDirection-enum"></a>enum QTapReading::<span class="name">TapDirection</span></h3> <p>The tap direction is indicated using flags. Applications should check for the presence of a particular flag as multiple flags may be set at once.</p> <p>The X, Y and Z flags allow an app to check for taps along an axis without caring about the direction.</p> <pre class="cpp"> <span class="keyword">if</span> (reading<span class="operator">-</span><span class="operator">></span>tapDirection()<span class="operator">&</span><span class="type"><a href="qtapreading.html">QTapReading</a></span><span class="operator">::</span>X) { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } </pre> <p>The *_Pos and *_Neg flags allow checking for taps in a specific direction. Note that some devices cannot determine the direction of a tap and will set both the _Pos and _Neg flag for the detected axis. Previous versions of the API did not allow this. Applications that check for the _Pos and _Neg flags as values should be updated so they can work with all devices.</p> <p>For example, if you have code like</p> <pre class="cpp plain"> if (reading->tapDirection() == QTapReading::X_Pos) { ... } </pre> <p>you can rewrite it as</p> <pre class="cpp"> <span class="keyword">if</span> (reading<span class="operator">-</span><span class="operator">></span>tapDirection()<span class="operator">&</span><span class="type"><a href="qtapreading.html">QTapReading</a></span><span class="operator">::</span>X_Pos) { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } </pre> <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>QTapReading::Undefined</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">This value means that the direction is unknown.</td></tr> <tr><td class="topAlign"><code>QTapReading::X</code></td><td class="topAlign tblval"><code>0x0001</code></td><td class="topAlign">This flag is set if the tap was along the X axis.</td></tr> <tr><td class="topAlign"><code>QTapReading::Y</code></td><td class="topAlign tblval"><code>0x0002</code></td><td class="topAlign">This flag is set if the tap was along the Y axis.</td></tr> <tr><td class="topAlign"><code>QTapReading::Z</code></td><td class="topAlign tblval"><code>0x0004</code></td><td class="topAlign">This flag is set if the tap was along the Z axis.</td></tr> <tr><td class="topAlign"><code>QTapReading::X_Pos</code></td><td class="topAlign tblval"><code>0x0011</code></td><td class="topAlign">This flag is set if the tap was towards the positive X direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::Y_Pos</code></td><td class="topAlign tblval"><code>0x0022</code></td><td class="topAlign">This flag is set if the tap was towards the positive Y direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::Z_Pos</code></td><td class="topAlign tblval"><code>0x0044</code></td><td class="topAlign">This flag is set if the tap was towards the positive Z direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::X_Neg</code></td><td class="topAlign tblval"><code>0x0101</code></td><td class="topAlign">This flag is set if the tap was towards the negative X direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::Y_Neg</code></td><td class="topAlign tblval"><code>0x0202</code></td><td class="topAlign">This flag is set if the tap was towards the negative Y direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::Z_Neg</code></td><td class="topAlign tblval"><code>0x0404</code></td><td class="topAlign">This flag is set if the tap was towards the negative Z direction.</td></tr> <tr><td class="topAlign"><code>QTapReading::X_Both</code></td><td class="topAlign tblval"><code>0x0111</code></td><td class="topAlign">Equivalent to <code>X_Pos|X_Neg</code>. Returned by devices that cannot detect the direction of a tap.</td></tr> <tr><td class="topAlign"><code>QTapReading::Y_Both</code></td><td class="topAlign tblval"><code>0x0222</code></td><td class="topAlign">Equivalent to <code>Y_Pos|Y_Neg</code>. Returned by devices that cannot detect the direction of a tap.</td></tr> <tr><td class="topAlign"><code>QTapReading::Z_Both</code></td><td class="topAlign tblval"><code>0x0444</code></td><td class="topAlign">Equivalent to <code>Z_Pos|Z_Neg</code>. Returned by devices that cannot detect the direction of a tap.</td></tr> </table></div> <!-- @@@TapDirection --> </div> <div class="prop"> <h2>Property Documentation</h2> <!-- $$$doubleTap-prop$$$isDoubleTap --> <h3 class="fn" id="doubleTap-prop"><a name="doubleTap-prop"></a><span class="name">doubleTap</span> : const <span class="type">bool</span></h3> <p>This property holds a value indicating if there was a single or double tap.</p> <ul> <li>true - double tap</li> <li>false - single tap</li> </ul> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isDoubleTap</b></span>() const</td></tr> </table></div> <p><b>See also </b><a href="qtapreading.html#qtapreading-units">QTapReading Units</a>.</p> <!-- @@@doubleTap --> <!-- $$$tapDirection-prop$$$tapDirection --> <h3 class="fn" id="tapDirection-prop"><a name="tapDirection-prop"></a><span class="name">tapDirection</span> : const <span class="type"><a href="qtapreading.html#TapDirection-enum">TapDirection</a></span></h3> <p>This property holds the direction of the tap.</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> TapDirection </td><td class="memItemRight bottomAlign"><span class="name"><b>tapDirection</b></span>() const</td></tr> </table></div> <p><b>See also </b><a href="qtapreading.html#qtapreading-units">QTapReading Units</a>.</p> <!-- @@@tapDirection --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$setDoubleTap[overload1]$$$setDoubleTapbool --> <h3 class="fn" id="setDoubleTap"><a name="setDoubleTap"></a><span class="type">void</span> QTapReading::<span class="name">setDoubleTap</span>(<span class="type">bool</span> <i>doubleTap</i>)</h3> <p>Sets the double tap status of the reading to <i>doubleTap</i>.</p> <p><b>See also </b><a href="qtapreading.html#doubleTap-prop">isDoubleTap</a>().</p> <!-- @@@setDoubleTap --> <!-- $$$setTapDirection[overload1]$$$setTapDirectionTapDirection --> <h3 class="fn" id="setTapDirection"><a name="setTapDirection"></a><span class="type">void</span> QTapReading::<span class="name">setTapDirection</span>(<span class="type"><a href="qtapreading.html#TapDirection-enum">TapDirection</a></span> <i>tapDirection</i>)</h3> <p>Sets the tap direction to <i>tapDirection</i>.</p> <p><b>See also </b><a href="qtapreading.html#tapDirection-prop">tapDirection</a>().</p> <!-- @@@setTapDirection --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</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>