QGIS API Documentation  2.99.0-Master (0a63d1f)
qgsmaptooltouch.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptooltouch.h - map tool for zooming and panning using qgestures
3  ----------------------
4  begin : February 2012
5  copyright : (C) 2012 by Marco Bernasocchi
6  email : marco at bernawebdesign.ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMAPTOOLTOUCH_H
17 #define QGSMAPTOOLTOUCH_H
18 
19 #include "qgsmaptool.h"
20 #include <QGestureEvent>
21 #include <QPinchGesture>
22 #include "qgis_gui.h"
23 
24 class QgsMapCanvas;
25 
26 
32 class GUI_EXPORT QgsMapToolTouch : public QgsMapTool
33 {
34  public:
36  QgsMapToolTouch( QgsMapCanvas* canvas );
37 
38  ~QgsMapToolTouch();
39 
40  void activate() override;
41  void deactivate() override;
42  virtual void canvasMoveEvent( QgsMapMouseEvent* e ) override;
43  virtual void canvasReleaseEvent( QgsMapMouseEvent* e ) override;
44  virtual void canvasDoubleClickEvent( QgsMapMouseEvent* e ) override;
45 
46  virtual Flags flags() const override { return QgsMapTool::Transient | QgsMapTool::AllowZoomRect; }
47 
48  bool gestureEvent( QGestureEvent *event ) override;
49 
50  private:
51 
53  bool mDragging;
55  bool mPinching;
56  void pinchTriggered( QPinchGesture *gesture );
57 };
58 
59 #endif
virtual void canvasMoveEvent(QgsMapMouseEvent *e)
Mouse move event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:144
Allow zooming by rectangle (by holding shift and dragging) while the tool is active.
Definition: qgsmaptool.h:66
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
virtual void activate()
called when set as currently active map tool
Definition: qgsmaptool.cpp:82
virtual void deactivate()
called when map tool is being deactivated
Definition: qgsmaptool.cpp:98
A map tool for panning the map.
Abstract base class for all map tools.
Definition: qgsmaptool.h:51
virtual void canvasDoubleClickEvent(QgsMapMouseEvent *e)
Mouse double click event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:149
virtual Flags flags() const override
Returns the flags for the map tool.
virtual void canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
Definition: qgsmaptool.cpp:159