QGesture 类表示包含描述相应用户输入特性的手势。 更多...
头: | #include <QGesture> |
qmake: | QT += widgets |
Since: | Qt 4.6 |
继承: | QObject |
继承者: |
QPanGesture , QPinchGesture , QSwipeGesture , QTapAndHoldGesture ,和 QTapGesture |
enum | GestureCancelPolicy { CancelNone, CancelAllInContext } |
|
QGesture (QObject * parent = Q_NULLPTR) | |
~QGesture () | |
GestureCancelPolicy | gestureCancelPolicy () const |
Qt::GestureType | gestureType () const |
bool | hasHotSpot () const |
QPointF | hotSpot () const |
void | setGestureCancelPolicy (GestureCancelPolicy policy ) |
void | setHotSpot (const QPointF & value ) |
Qt::GestureState | state () const |
void | unsetHotSpot () |
QGesture 类表示包含描述相应用户输入特性的手势。
手势对象不是由开发者直接构造的。它们的创建是通过 QGestureRecognizer 对象采用应用程序注册的;见 QGestureRecognizer::registerRecognizer ().
对于 Qt 中手势处理的概述和在应用程序中使用手势的信息,见 在 Widget 和图形视图中的手势 文档。
The class has a list of properties that can be queried by the user to get some gesture-specific arguments. For example, the pinch gesture has a scale factor that is exposed as a property.
Developers of custom gesture recognizers can add additional properties in order to provide additional information about a gesture. This can be done by adding new dynamic properties to a QGesture object, or by subclassing the QGesture class (or one of its subclasses).
QGesture instance is implicitly created when needed and is owned by Qt. Developers should never destroy them or store them for later use as Qt may destroy particular instances of them and create new ones to replace them.
The registered gesture recognizer monitors the input events for the target object via its recognize() function, updating the properties of the gesture object as required.
The gesture object may be delivered to the target object in a QGestureEvent if the corresponding gesture is active or has just been canceled. Each event that is delivered contains a list of gesture objects, since support for more than one gesture may be enabled for the target object. Due to the way events are handled in Qt, gesture events may be filtered by other objects.
另请参阅 QGestureEvent and QGestureRecognizer .
This enum describes how accepting a gesture can cancel other gestures automatically.
常量 | 值 | 描述 |
---|---|---|
QGesture::CancelNone
|
0
|
On accepting this gesture no other gestures will be affected. |
QGesture::CancelAllInContext
|
1
|
On accepting this gesture all gestures that are active in the context (respecting the Qt::GestureFlag that were specified when subscribed to the gesture) will be cancelled. |
This property holds the policy for deciding what happens on accepting a gesture
On accepting one gesture Qt can automatically cancel other gestures that belong to other targets. The policy is normally set to not cancel any other gestures and can be set to cancel all active gestures in the context. For example for all child widgets.
访问函数:
GestureCancelPolicy | gestureCancelPolicy () const |
void | setGestureCancelPolicy (GestureCancelPolicy policy ) |
此特性保持手势的类型
访问函数:
Qt::GestureType | gestureType () const |
此特性保持手势是否拥有热点
访问函数:
bool | hasHotSpot () const |
This property holds the point that is used to find the receiver for the gesture event.
The hot-spot is a point in the global coordinate system, use QWidget::mapFromGlobal () 或 QGestureEvent::mapToGraphicsScene () to get a local hot-spot.
The hot-spot should be set by the gesture recognizer to allow gesture event delivery to a QGraphicsObject .
访问函数:
QPointF | hotSpot () const |
void | setHotSpot (const QPointF & value ) |
void | unsetHotSpot () |
此特性保持手势的当前状态
访问函数:
Qt::GestureState | state () const |
构造新的手势对象采用给定 parent .
QGesture 对象是由手势识别器创建的在 QGestureRecognizer::create () 函数。
销毁手势对象。