QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmaptoolzoom.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaptoolzoom.h - map tool for zooming
3 ----------------------
4 begin : January 2006
5 copyright : (C) 2006 by Martin Dobias
6 email : wonder.sk at gmail dot com
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 QGSMAPTOOLZOOM_H
17#define QGSMAPTOOLZOOM_H
18
19#include "qgis_gui.h"
20#include "qgsmaptool.h"
21
22#include <QRect>
23
24class QgsRubberBand;
25
31class GUI_EXPORT QgsMapToolZoom : public QgsMapTool
32{
33 Q_OBJECT
34
35 public:
37 QgsMapToolZoom( QgsMapCanvas *canvas, bool zoomOut );
38 ~QgsMapToolZoom() override;
39
40 Flags flags() const override;
41 void canvasMoveEvent( QgsMapMouseEvent *e ) override;
42 void canvasPressEvent( QgsMapMouseEvent *e ) override;
43 void canvasReleaseEvent( QgsMapMouseEvent *e ) override;
44 void keyPressEvent( QKeyEvent *e ) override;
45 void keyReleaseEvent( QKeyEvent *e ) override;
46 void deactivate() override;
47
48 protected:
50 QRect mZoomRect;
51 // minimum pixel size of diagonal of the zoom rectangle
52 int mMinPixelZoom = 20;
53
58
60 bool mDragging = false;
61
63 bool mCanceled = false;
64
66
69
70 private:
71 void setZoomMode( bool zoomOut, bool force = false );
72};
73
74#endif
A mouse event which is the result of a user interaction with a QgsMapCanvas.
bool mDragging
Flag to indicate a map canvas drag operation is taking place.
bool mNativeZoomOut
native tool
QRect mZoomRect
stores actual zoom rect
bool mCanceled
Flag to indicate the user has canceled the current zoom operation.
QgsRubberBand * mRubberBand
QCursor mZoomOutCursor
QCursor mZoomInCursor
QgsMapToolZoom(QgsMapCanvas *canvas, bool zoomOut)
constructor
bool mZoomOut
indicates whether we're zooming in or out
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
QgsMapTool(QgsMapCanvas *canvas)
Constructor takes a map canvas as a parameter.
QFlags< Flag > Flags
Definition qgsmaptool.h:115
friend class QgsMapCanvas
Definition qgsmaptool.h:380
virtual void canvasPressEvent(QgsMapMouseEvent *e)
Mouse press event for overriding. Default implementation does nothing.
virtual void canvasMoveEvent(QgsMapMouseEvent *e)
Mouse move event for overriding. Default implementation does nothing.
virtual void keyPressEvent(QKeyEvent *e)
Key event for overriding. Default implementation does nothing.
virtual void keyReleaseEvent(QKeyEvent *e)
Key event for overriding. Default implementation does nothing.
virtual Flags flags() const
Returns the flags for the map tool.
Definition qgsmaptool.h:120
virtual void canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
virtual void deactivate()
called when map tool is being deactivated
Responsible for drawing transient features (e.g.