The QTapReading class represents one reading from the tap sensor. 更多...
| 头: | #include <QTapReading> | 
| qmake: | QT += sensors | 
| Since: | Qt 5.1 | 
| 继承: | QSensorReading | 
该类在 Qt 5.1 引入。
| enum | TapDirection { Undefined, X, Y, Z, X_Pos, …, Z_Both } | 
| bool | isDoubleTap () const | 
| void | setDoubleTap (bool doubleTap ) | 
| void | setTapDirection (QTapReading::TapDirection tapDirection ) | 
| QTapReading::TapDirection | tapDirection () const | 
The tap sensor registers tap events along the 3 axes that originate from the phone. The axes are arranged as follows.
					By default it returns only double tap events. The QTapSensor::returnDoubleTapEvents property must be set to false to return individual tap events.
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.
The X, Y and Z flags allow an app to check for taps along an axis without caring about the direction.
if (reading->tapDirection()&QTapReading::X) { ... }
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.
例如,若有代码像
 if (reading->tapDirection() == QTapReading::X_Pos) {
     ...
 }
					
					可以把它重写成
if (reading->tapDirection()&QTapReading::X_Pos) { ... }
| 常量 | 值 | 描述 | 
|---|---|---|
								
QTapReading::Undefined
								
							 | 
							
								
0
								
							 | 
							This value means that the direction is unknown. | 
								
QTapReading::X
								
							 | 
							
								
0x0001
								
							 | 
							This flag is set if the tap was along the X axis. | 
								
QTapReading::Y
								
							 | 
							
								
0x0002
								
							 | 
							This flag is set if the tap was along the Y axis. | 
								
QTapReading::Z
								
							 | 
							
								
0x0004
								
							 | 
							This flag is set if the tap was along the Z axis. | 
								
QTapReading::X_Pos
								
							 | 
							
								
0x0011
								
							 | 
							This flag is set if the tap was towards the positive X direction. | 
								
QTapReading::Y_Pos
								
							 | 
							
								
0x0022
								
							 | 
							This flag is set if the tap was towards the positive Y direction. | 
								
QTapReading::Z_Pos
								
							 | 
							
								
0x0044
								
							 | 
							This flag is set if the tap was towards the positive Z direction. | 
								
QTapReading::X_Neg
								
							 | 
							
								
0x0101
								
							 | 
							This flag is set if the tap was towards the negative X direction. | 
								
QTapReading::Y_Neg
								
							 | 
							
								
0x0202
								
							 | 
							This flag is set if the tap was towards the negative Y direction. | 
								
QTapReading::Z_Neg
								
							 | 
							
								
0x0404
								
							 | 
							This flag is set if the tap was towards the negative Z direction. | 
								
QTapReading::X_Both
								
							 | 
							
								
0x0111
								
							 | 
							
								相当于
								
X_Pos|X_Neg
								
								. Returned by devices that cannot detect the direction of a tap.
							 | 
						
								
QTapReading::Y_Both
								
							 | 
							
								
0x0222
								
							 | 
							
								相当于
								
Y_Pos|Y_Neg
								
								. Returned by devices that cannot detect the direction of a tap.
							 | 
						
								
QTapReading::Z_Both
								
							 | 
							
								
0x0444
								
							 | 
							
								相当于
								
Z_Pos|Z_Neg
								
								. Returned by devices that cannot detect the direction of a tap.
							 | 
						
This property holds a value indicating if there was a single or double tap.
访问函数:
| bool | isDoubleTap () const | 
另请参阅 QTapReading Units .
This property holds the direction of the tap.
访问函数:
| QTapReading::TapDirection | tapDirection () const | 
另请参阅 QTapReading Units .
Sets the double tap status of the reading to doubleTap .
另请参阅 isDoubleTap ().
Sets the tap direction to tapDirection .
另请参阅 tapDirection ().