QTapReadingclass represents one reading from the tap sensor. 更多 …
def
isDoubleTap
()
def
setDoubleTap
(doubleTap)
def
setTapDirection
(tapDirection)
def
tapDirection
()
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
returnDoubleTapEventsproperty must be set to false to return individual tap events.
QTapReading
(
parent
)
¶
parent
–
QObject
PySide2.QtSensors.QTapReading.
TapDirection
¶
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.
For example, if you have code like
you can rewrite it as
|
常量 |
描述 |
|---|---|
|
QTapReading.Undefined |
This value means that the direction is unknown. |
|
QTapReading.X |
This flag is set if the tap was along the X axis. |
|
QTapReading.Y |
This flag is set if the tap was along the Y axis. |
|
QTapReading.Z |
This flag is set if the tap was along the Z axis. |
|
QTapReading.X_Pos |
This flag is set if the tap was towards the positive X direction. |
|
QTapReading.Y_Pos |
This flag is set if the tap was towards the positive Y direction. |
|
QTapReading.Z_Pos |
This flag is set if the tap was towards the positive Z direction. |
|
QTapReading.X_Neg |
This flag is set if the tap was towards the negative X direction. |
|
QTapReading.Y_Neg |
This flag is set if the tap was towards the negative Y direction. |
|
QTapReading.Z_Neg |
This flag is set if the tap was towards the negative Z direction. |
|
QTapReading.X_Both |
相当于
|
|
QTapReading.Y_Both |
相当于
|
|
QTapReading.Z_Both |
相当于
|
PySide2.QtSensors.QTapReading.
isDoubleTap
(
)
¶
bool
PySide2.QtSensors.QTapReading.
setDoubleTap
(
doubleTap
)
¶
doubleTap
–
bool
Sets the double tap status of the reading to
doubleTap
.
另请参阅
PySide2.QtSensors.QTapReading.
setTapDirection
(
tapDirection
)
¶
tapDirection
–
TapDirection
Sets the tap direction to
tapDirection
.
另请参阅
PySide2.QtSensors.QTapReading.
tapDirection
(
)
¶
另请参阅