Extends Gesture

Gesture.Swipe

A discrete gesture recognizer for single and multi-touch swipes. A swipe occurs when the specified number of touch points have moved far enough, mostly in the allowed direction.

If you are looking for a continuous swipe gesture, use Gesture.Pan instead.

Item {
    with Gesture.Swipe {
        touchesRequired: 2
        direction: .Down

        on swiped {
            System.log("A two-finger downward swipe!")
        }
    }
}

A single swipe gestures only recognizes a swipe in a one direction. If you want to recognize more than one direction, use multiple swipe gestures.

event swiped()

Event emitted when the swipe is recognized.

property Gesture.Swipe.Direction direction: .Right

The permitted direction for the swipe.

Gesture.Swipe.Direction.Left

A leftward swipe.

Gesture.Swipe.Direction.Right

A rightward swipe.

Gesture.Swipe.Direction.Up

An upward swipe.

Gesture.Swipe.Direction.Down

A downward swipe.

property Int touchesRequired: 1

The number of touch points for the swipe.