QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsplottoolzoom.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsplottoolzoom.h
3 ---------------
4 begin : March 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPLOTTOOLZOOM_H
19#define QGSPLOTTOOLZOOM_H
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23#include "qgsplottool.h"
24
26
27
34class GUI_EXPORT QgsPlotToolZoom : public QgsPlotTool
35{
36 Q_OBJECT
37
38 public:
43 ~QgsPlotToolZoom() override;
44
45 void plotPressEvent( QgsPlotMouseEvent *event ) override;
46 void plotMoveEvent( QgsPlotMouseEvent *event ) override;
47 void plotReleaseEvent( QgsPlotMouseEvent *event ) override;
48 void keyPressEvent( QKeyEvent *event ) override;
49 void keyReleaseEvent( QKeyEvent *event ) override;
50 void deactivate() override;
51
52 protected:
58 virtual QPointF constrainStartPoint( QPointF scenePoint ) const SIP_SKIP;
59
65 virtual QPointF constrainMovePoint( QPointF scenePoint ) const SIP_SKIP;
66
72 virtual QRectF constrainBounds( const QRectF &sceneBounds ) const SIP_SKIP;
73
79 virtual void zoomOutClickOn( QPointF scenePoint ) SIP_SKIP;
80
86 virtual void zoomInClickOn( QPointF scenePoint ) SIP_SKIP;
87
89 bool mMarqueeZoom = false;
90
91 protected:
94
97
98 private:
100 std::unique_ptr<QgsPlotRectangularRubberBand> mRubberBand;
101
102 void startMarqueeZoom( QPointF scenePoint );
103};
104
105#endif // QGSPLOTTOOLZOOM_H
Plot canvas is a class for displaying interactive 2d charts and plots.
A mouse event which is the result of a user interaction with a QgsPlotCanvas.
A rectangular rubber band for use within QgsPlotCanvas widgets.
virtual QRectF constrainBounds(const QRectF &sceneBounds) const
Applies constraints to the overall bounds of the rubber band.
~QgsPlotToolZoom() override
QPointF mRubberBandStartPos
Start position for drag, in scene coordinates.
virtual QPointF constrainStartPoint(QPointF scenePoint) const
Applies constraints to the start point of the zoom rubber band.
QPoint mMousePressStartPos
Start position for mouse drag.
virtual void zoomInClickOn(QPointF scenePoint)
Handles a zoom out click on the given point.
bool mMarqueeZoom
Will be true will marquee zoom operation is in progress.
virtual QPointF constrainMovePoint(QPointF scenePoint) const
Applies constraints to a move point of the zoom rubber band.
virtual void zoomOutClickOn(QPointF scenePoint)
Handles a zoom out click on the given point.
QgsPlotToolZoom(QgsPlotCanvas *canvas)
Constructor for QgsPlotToolZoom, with the associated canvas.
QgsPlotCanvas * canvas() const
Returns the tool's plot canvas.
virtual void deactivate()
Called when the tool is being deactivated.
QgsPlotTool(QgsPlotCanvas *canvas, const QString &name)
Constructor takes a plot canvas as a parameter.
virtual void plotMoveEvent(QgsPlotMouseEvent *event)
Mouse move event for overriding.
virtual void keyReleaseEvent(QKeyEvent *event)
Key release event for overriding.
virtual void keyPressEvent(QKeyEvent *event)
Key press event for overriding.
virtual void plotPressEvent(QgsPlotMouseEvent *event)
Mouse press event for overriding.
virtual void plotReleaseEvent(QgsPlotMouseEvent *event)
Mouse release event for overriding.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:134