libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::TapRecognizer Class Reference

#include <InputHandler.h>

+ Inheritance diagram for osmscout::TapRecognizer:

Signals

void doubleTap (const QPoint p)
 
void longTap (const QPoint p)
 
void tap (const QPoint p)
 
void tapAndDrag (const QPoint p)
 
void tapLongTap (const QPoint p)
 

Public Member Functions

void setPhysicalDpi (double physicalDpi)
 
 TapRecognizer ()
 
void touch (const QTouchEvent &event)
 
 ~TapRecognizer () override=default
 

Detailed Description

Simple class for recognizing some basic gestures: tap, double tap, long-tap and tap-and-hold.

Widget should send own QTouchEvent to this object, when some tap gesture is recognized it emits one of its signals.

  • Tap: touch shorter than holdInterval (1000 ms) followed with pause longer than tapInterval (200 ms)
  • Long tap: touch longer than holdInterval (1000 ms)
  • Double tap: tap followed by second one within tapInterval (200 ms)
  • Tap, drag: tap followed by drag
  • Tap, long tap: tap followed by long tap within tapInterval (200 ms)

Physical DPI of display should be setup before first use. TapRecognizer use some small move tolerance (~ 2.5 mm), it means that events are emitted even that touch point is moving within this tolerance. For double tap, when second tap is farther than this tolerance, double-tap event is not emitted.

Constructor & Destructor Documentation

◆ TapRecognizer()

osmscout::TapRecognizer::TapRecognizer ( )
inline

◆ ~TapRecognizer()

osmscout::TapRecognizer::~TapRecognizer ( )
overridedefault

Member Function Documentation

◆ doubleTap

void osmscout::TapRecognizer::doubleTap ( const QPoint  p)
signal

◆ longTap

void osmscout::TapRecognizer::longTap ( const QPoint  p)
signal

◆ setPhysicalDpi()

void osmscout::TapRecognizer::setPhysicalDpi ( double  physicalDpi)
inline

◆ tap

void osmscout::TapRecognizer::tap ( const QPoint  p)
signal

◆ tapAndDrag

void osmscout::TapRecognizer::tapAndDrag ( const QPoint  p)
signal

◆ tapLongTap

void osmscout::TapRecognizer::tapLongTap ( const QPoint  p)
signal

◆ touch()

void osmscout::TapRecognizer::touch ( const QTouchEvent &  event)

The documentation for this class was generated from the following files: