QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsPlotToolZoom Class Reference

Plot tool for zooming into and out of the plot. More...

#include <qgsplottoolzoom.h>

Inheritance diagram for QgsPlotToolZoom:
Inheritance graph
[legend]

Public Member Functions

 QgsPlotToolZoom (QgsPlotCanvas *canvas)
 Constructor for QgsPlotToolZoom, with the associated canvas.
 
 ~QgsPlotToolZoom () override
 
void deactivate () override
 Called when the tool is being deactivated.
 
void keyPressEvent (QKeyEvent *event) override
 Key press event for overriding.
 
void keyReleaseEvent (QKeyEvent *event) override
 Key release event for overriding.
 
void plotMoveEvent (QgsPlotMouseEvent *event) override
 Mouse move event for overriding.
 
void plotPressEvent (QgsPlotMouseEvent *event) override
 Mouse press event for overriding.
 
void plotReleaseEvent (QgsPlotMouseEvent *event) override
 Mouse release event for overriding.
 
- Public Member Functions inherited from QgsPlotTool
 ~QgsPlotTool () override
 
QAction * action ()
 Returns the action associated with the tool or nullptr if no action is associated.
 
virtual void activate ()
 Called when the tool is set as the currently active plot tool.
 
QgsPlotCanvascanvas () const
 Returns the tool's plot canvas.
 
virtual bool canvasToolTipEvent (QHelpEvent *event)
 Tooltip event for overriding.
 
virtual Qgis::PlotToolFlags flags () const
 Returns the flags for the plot tool.
 
virtual bool gestureEvent (QGestureEvent *event)
 Gesture event for overriding.
 
bool isActive () const
 Returns true if this tool is the current tool active on the plot canvas.
 
virtual void plotDoubleClickEvent (QgsPlotMouseEvent *event)
 Mouse double-click event for overriding.
 
virtual bool populateContextMenuWithEvent (QMenu *menu, QgsPlotMouseEvent *event)
 Allows the tool to populate and customize the given menu, prior to showing it in response to a right-mouse button click.
 
void setAction (QAction *action)
 Associates an action with this tool.
 
void setCursor (const QCursor &cursor)
 Sets a user defined cursor for use when the tool is active.
 
QString toolName () const
 Returns a user-visible, translated name for the tool.
 
virtual void wheelEvent (QWheelEvent *event)
 Mouse wheel event for overriding.
 

Protected Member Functions

virtual QRectF constrainBounds (const QRectF &sceneBounds) const
 Applies constraints to the overall bounds of the rubber band.
 
virtual QPointF constrainMovePoint (QPointF scenePoint) const
 Applies constraints to a move point of the zoom rubber band.
 
virtual QPointF constrainStartPoint (QPointF scenePoint) const
 Applies constraints to the start point of the zoom rubber band.
 
virtual void zoomInClickOn (QPointF scenePoint)
 Handles a zoom out click on the given point.
 
virtual void zoomOutClickOn (QPointF scenePoint)
 Handles a zoom out click on the given point.
 
- Protected Member Functions inherited from QgsPlotTool
 QgsPlotTool (QgsPlotCanvas *canvas, const QString &name)
 Constructor takes a plot canvas as a parameter.
 
bool isClickAndDrag (QPoint startViewPoint, QPoint endViewPoint) const
 Returns true if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a "click and drag".
 
QgsPointXY toCanvasCoordinates (const QgsPoint &point) const
 Converts a point in map coordinates to the associated canvas point.
 
QgsPoint toMapCoordinates (const QgsPointXY &point) const
 Converts a point on the canvas to the associated map coordinate.
 

Protected Attributes

bool mMarqueeZoom = false
 Will be true will marquee zoom operation is in progress.
 
QPoint mMousePressStartPos
 Start position for mouse drag.
 
QPointF mRubberBandStartPos
 Start position for drag, in scene coordinates.
 
- Protected Attributes inherited from QgsPlotTool
QPointer< QAction > mAction
 Optional action associated with tool.
 
QgsPlotCanvasmCanvas = nullptr
 The pointer to the canvas.
 
QCursor mCursor = Qt::ArrowCursor
 Cursor used by tool.
 
QString mToolName
 Translated name of the map tool.
 

Additional Inherited Members

- Signals inherited from QgsPlotTool
void activated ()
 Emitted when the tool is activated.
 
void deactivated ()
 Emitted when the tool is deactivated.
 
- Static Protected Member Functions inherited from QgsPlotTool
static QPointF constrainPointToRect (QPointF point, const QRectF &rect)
 Constrains a point to force it to fall within the specified rectangle.
 

Detailed Description

Plot tool for zooming into and out of the plot.

Since
QGIS 3.26

Definition at line 34 of file qgsplottoolzoom.h.

Constructor & Destructor Documentation

◆ QgsPlotToolZoom()

QgsPlotToolZoom::QgsPlotToolZoom ( QgsPlotCanvas canvas)

Constructor for QgsPlotToolZoom, with the associated canvas.

Definition at line 25 of file qgsplottoolzoom.cpp.

◆ ~QgsPlotToolZoom()

QgsPlotToolZoom::~QgsPlotToolZoom ( )
overridedefault

Member Function Documentation

◆ constrainBounds()

QRectF QgsPlotToolZoom::constrainBounds ( const QRectF &  sceneBounds) const
protectedvirtual

Applies constraints to the overall bounds of the rubber band.

Note
Not available in Python bindings

Reimplemented in QgsPlotToolXAxisZoom.

Definition at line 141 of file qgsplottoolzoom.cpp.

◆ constrainMovePoint()

QPointF QgsPlotToolZoom::constrainMovePoint ( QPointF  scenePoint) const
protectedvirtual

Applies constraints to a move point of the zoom rubber band.

Note
Not available in Python bindings

Reimplemented in QgsPlotToolXAxisZoom.

Definition at line 136 of file qgsplottoolzoom.cpp.

◆ constrainStartPoint()

QPointF QgsPlotToolZoom::constrainStartPoint ( QPointF  scenePoint) const
protectedvirtual

Applies constraints to the start point of the zoom rubber band.

Note
Not available in Python bindings

Reimplemented in QgsPlotToolXAxisZoom.

Definition at line 131 of file qgsplottoolzoom.cpp.

◆ deactivate()

void QgsPlotToolZoom::deactivate ( )
overridevirtual

Called when the tool is being deactivated.

Reimplemented from QgsPlotTool.

Definition at line 121 of file qgsplottoolzoom.cpp.

◆ keyPressEvent()

void QgsPlotToolZoom::keyPressEvent ( QKeyEvent *  event)
overridevirtual

Key press event for overriding.

The default implementation does nothing. When subclasses implement this method and have acted on the event, they must explicitly call event->accept() to prevent the event from being passed on to other widgets.

Reimplemented from QgsPlotTool.

Definition at line 95 of file qgsplottoolzoom.cpp.

◆ keyReleaseEvent()

void QgsPlotToolZoom::keyReleaseEvent ( QKeyEvent *  event)
overridevirtual

Key release event for overriding.

The default implementation does nothing. When subclasses implement this method and have acted on the event, they must explicitly call event->accept() to prevent the event from being passed on to other widgets.

Reimplemented from QgsPlotTool.

Definition at line 108 of file qgsplottoolzoom.cpp.

◆ plotMoveEvent()

void QgsPlotToolZoom::plotMoveEvent ( QgsPlotMouseEvent event)
overridevirtual

Mouse move event for overriding.

The default implementation does nothing. When subclasses implement this method and have acted on the event, they must explicitly call event->accept() to prevent the event from being passed on to other widgets.

Reimplemented from QgsPlotTool.

Definition at line 61 of file qgsplottoolzoom.cpp.

◆ plotPressEvent()

void QgsPlotToolZoom::plotPressEvent ( QgsPlotMouseEvent event)
overridevirtual

Mouse press event for overriding.

The default implementation does nothing. When subclasses implement this method and have acted on the event, they must explicitly call event->accept() to prevent the event from being passed on to other widgets.

Reimplemented from QgsPlotTool.

Definition at line 36 of file qgsplottoolzoom.cpp.

◆ plotReleaseEvent()

void QgsPlotToolZoom::plotReleaseEvent ( QgsPlotMouseEvent event)
overridevirtual

Mouse release event for overriding.

The default implementation does nothing. When subclasses implement this method and have acted on the event, they must explicitly call event->accept() to prevent the event from being passed on to other widgets.

Reimplemented from QgsPlotTool.

Definition at line 72 of file qgsplottoolzoom.cpp.

◆ zoomInClickOn()

void QgsPlotToolZoom::zoomInClickOn ( QPointF  scenePoint)
protectedvirtual

Handles a zoom out click on the given point.

Note
Not available in Python bindings

Reimplemented in QgsPlotToolXAxisZoom.

Definition at line 153 of file qgsplottoolzoom.cpp.

◆ zoomOutClickOn()

void QgsPlotToolZoom::zoomOutClickOn ( QPointF  scenePoint)
protectedvirtual

Handles a zoom out click on the given point.

Note
Not available in Python bindings

Reimplemented in QgsPlotToolXAxisZoom.

Definition at line 146 of file qgsplottoolzoom.cpp.

Member Data Documentation

◆ mMarqueeZoom

bool QgsPlotToolZoom::mMarqueeZoom = false
protected

Will be true will marquee zoom operation is in progress.

Definition at line 92 of file qgsplottoolzoom.h.

◆ mMousePressStartPos

QPoint QgsPlotToolZoom::mMousePressStartPos
protected

Start position for mouse drag.

Definition at line 97 of file qgsplottoolzoom.h.

◆ mRubberBandStartPos

QPointF QgsPlotToolZoom::mRubberBandStartPos
protected

Start position for drag, in scene coordinates.

Definition at line 100 of file qgsplottoolzoom.h.


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