Home · All Classes · Main Classes · Deprecated

Gestures and multipoint touch

Gestures

A gesture is a high-level event that represents a series of user input. Qt and MeeGo Touch support the following gestures:

Gesture

User interaction

Class

Symbol

Pan

Press, drag, release

QPanGesture

gesture-pan.png

Pinch

Press (with two fingers), move fingers on surface,
optionally release one of the fingers and reposition, release

QPinchGesture

gesture-pinch.png

Swipe

Press, quick drag and release

QSwipeGesture

gesture-swipe.png

Tap and hold

Press, wait

QTapAndHoldGesture

gesture-tapandhold.png

Tap

Press, release

QTapGesture

gesture-tap.png

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.

Gestures used by MeeGo Touch

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:

Multipoint touch

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.

Simulating multipoint touch

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.

APIS related to gestures

MeeGo Touch provides several event handlers for gestures:

These event handlers can be re-implemented to act upon all or specific gestures, in the same way as the existing methods QGraphicsItem::mousePressEvent, QGraphicsItem::mouseReleaseEvent, and so on.

There are also corresponding methods in both the MWidgetController and the MWidgetView for extending or writing new MeeGo Touch common components.

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).

Gestures examples and tips for applications

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)
Doxygen 1.6.1
MeeGo Touch