|Home · All Classes · Main Classes · Deprecated|
A gesture is a high-level event that represents a series of user input. Qt and MeeGo Touch support the following gestures:
Press, drag, release
Press (with two fingers), move fingers on surface,
Press, quick drag and release
Tap and hold
As a gesture is merely an interpreted series of input, the application determines what the gesture actually means. For example, a pinch gesture may be used to either rotate or zoom a picture, or both. If combined, gestures may have overlapping interactions, as is the case of swipe and pan. It is up to the application design to make sure there are no overlapping interactions in UI (the result of overlapping interactions is undefined). Typically a swipe gesture would be used in a UI where a flick should be interpreted as "next" or "previous", while a pan gesture implies an event with acceleration such as scrolling a web page.
While all of the above gestures are touch-activated, gestures can potentially use any type of input such as key events or sensor data. You can use the QGestureRecognizer framework to register new custom gesture types.
While gesture events are mainly meant for application consumption, the MeeGo Touch UI design guidelines specify some default actions based on gestures. Unless the application developer overrides the behaviour, gestures may be consumed by the framework itself in the following cases:
While some of the gestures mentioned above (such as pinch) are implemented using multipoint touch events, by itself multipoint touch merely refers to the capability of detecting several fingers on the screen at once. Multipoint touch events are also directly accessible by applications in a low-level form comparable to mouse and key presses and releases, where the actual interpretation of the events is left entirely up to you. Note: Multipoint touch requires special hardware to function, since many touch input devices are not capable of detecting multiple touch points at once.
In Qt, multipoint-touch input is delivered through the QTouchEvent class, through which it is possible to determine all the currently touched screen points.
Note: Since multipoint touch events are not delivered to widgets by default, the delivery must be explicitly enabled with the QGraphicsItem::setAcceptTouchEvents method.
You can simulate the multipoint touch pinch gesture without real multipoint-touch hardware, for example, in a development environment on a standard PC. Simply hold down the <Ctrl> key on the keyboard, then press and drag with the left mouse button.
MeeGo Touch provides several event handlers for gestures:
Gestures are not delivered to widgets by default, gesture delivery is enabled by the QGraphicsObject::grabGesture method.
MeeGo Touch currently replaces some of the default Qt gesture recognizers with versions capable of interpreting regular mouse events in addition to the touch events used by Qt. Pan and swipe are also one-finger gestures in MeeGo Touch, while they are two- and three-finger gestures, respectively, in Qt (as of version 4.7).
The examples/gestures directory of the MeeGo Touch source contains a sample application demonstrating proper use of gestures combined with MeeGo Touch widgets. The example is a gallery application, where pinching zooms and rotates the picture simultaneously, while swiping left or right changes the picture.
The example below illustrates the following:
Below is the example code relevant to the gestures:
|Copyright © 2010 Nokia Corporation||Generated on Thu Feb 24 06:02:51 2011 (PDT)