Abstract base class for all interactive plot tools.
More...
#include <qgsplottool.h>
|
static QPointF | constrainPointToRect (QPointF point, const QRectF &rect) |
| Constrains a point to force it to fall within the specified rectangle. More...
|
|
Abstract base class for all interactive plot tools.
Plot tools are user tools for manipulating and interacting with a QgsPlotCanvas.
- Since
- QGIS 3.26
Definition at line 57 of file qgsplottool.h.
◆ ~QgsPlotTool()
QgsPlotTool::~QgsPlotTool |
( |
| ) |
|
|
override |
◆ QgsPlotTool()
QgsPlotTool::QgsPlotTool |
( |
QgsPlotCanvas * |
canvas, |
|
|
const QString & |
name |
|
) |
| |
|
protected |
Constructor takes a plot canvas as a parameter.
Definition at line 25 of file qgsplottool.cpp.
◆ action()
QAction * QgsPlotTool::action |
( |
| ) |
|
Returns the action associated with the tool or nullptr
if no action is associated.
- See also
- setAction()
Definition at line 157 of file qgsplottool.cpp.
◆ activate()
void QgsPlotTool::activate |
( |
| ) |
|
|
virtual |
◆ activated
void QgsPlotTool::activated |
( |
| ) |
|
|
signal |
Emitted when the tool is activated.
◆ canvas()
◆ canvasToolTipEvent()
bool QgsPlotTool::canvasToolTipEvent |
( |
QHelpEvent * |
event | ) |
|
|
virtual |
Tooltip event for overriding.
Returns true
if the event was handled by the tool and should not be propagated further.
Definition at line 142 of file qgsplottool.cpp.
◆ constrainPointToRect()
QPointF QgsPlotTool::constrainPointToRect |
( |
QPointF |
point, |
|
|
const QRectF & |
rect |
|
) |
| |
|
staticprotected |
Constrains a point to force it to fall within the specified rectangle.
Definition at line 53 of file qgsplottool.cpp.
◆ deactivate()
void QgsPlotTool::deactivate |
( |
| ) |
|
|
virtual |
◆ deactivated
void QgsPlotTool::deactivated |
( |
| ) |
|
|
signal |
Emitted when the tool is deactivated.
◆ flags()
Qgis::PlotToolFlags QgsPlotTool::flags |
( |
| ) |
const |
|
virtual |
◆ gestureEvent()
bool QgsPlotTool::gestureEvent |
( |
QGestureEvent * |
event | ) |
|
|
virtual |
Gesture event for overriding.
Returns true
if the event was handled by the tool and should not be propagated further.
Definition at line 137 of file qgsplottool.cpp.
◆ isActive()
bool QgsPlotTool::isActive |
( |
| ) |
const |
Returns true
if this tool is the current tool active on the plot canvas.
Definition at line 97 of file qgsplottool.cpp.
◆ isClickAndDrag()
bool QgsPlotTool::isClickAndDrag |
( |
QPoint |
startViewPoint, |
|
|
QPoint |
endViewPoint |
|
) |
| const |
|
protected |
Returns true
if a mouse press/release operation which started at startViewPoint and ended at endViewPoint should be considered a "click and drag".
If false
is returned, the operation should be instead treated as just a click on startViewPoint.
Definition at line 46 of file qgsplottool.cpp.
◆ keyPressEvent()
void QgsPlotTool::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
virtual |
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 in QgsPlotToolZoom, and QgsPlotToolTemporaryKeyZoom.
Definition at line 127 of file qgsplottool.cpp.
◆ keyReleaseEvent()
void QgsPlotTool::keyReleaseEvent |
( |
QKeyEvent * |
event | ) |
|
|
virtual |
◆ plotDoubleClickEvent()
Mouse double-click 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.
Definition at line 107 of file qgsplottool.cpp.
◆ plotMoveEvent()
◆ plotPressEvent()
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 in QgsPlotToolPan, and QgsPlotToolZoom.
Definition at line 112 of file qgsplottool.cpp.
◆ plotReleaseEvent()
◆ populateContextMenuWithEvent()
bool QgsPlotTool::populateContextMenuWithEvent |
( |
QMenu * |
menu, |
|
|
QgsPlotMouseEvent * |
event |
|
) |
| |
|
virtual |
Allows the tool to populate and customize the given menu, prior to showing it in response to a right-mouse button click.
menu will be initially populated with a set of default, generic actions. Any new actions added to the menu should be correctly parented to menu.
A pointer to the plot mouse event can be provided to allow particular behavior depending on the plot tool.
This method can return true
to inform the caller that the menu was effectively populated.
The default implementation does nothing and returns false
.
- Note
- The context menu is only shown when the ShowContextMenu flag is present in flags().
Definition at line 167 of file qgsplottool.cpp.
◆ setAction()
void QgsPlotTool::setAction |
( |
QAction * |
action | ) |
|
Associates an action with this tool.
When the setTool method of QgsPlotCanvas is called the action's state will be set to on. Usually this will cause a toolbutton to appear pressed in and the previously used toolbutton to pop out.
- See also
- action()
Definition at line 152 of file qgsplottool.cpp.
◆ setCursor()
void QgsPlotTool::setCursor |
( |
const QCursor & |
cursor | ) |
|
Sets a user defined cursor for use when the tool is active.
Definition at line 162 of file qgsplottool.cpp.
◆ toCanvasCoordinates()
Converts a point in map coordinates to the associated canvas point.
May return an empty point if the map point cannot be converted to a canvas point.
Definition at line 41 of file qgsplottool.cpp.
◆ toMapCoordinates()
Converts a point on the canvas to the associated map coordinate.
May return an empty point if the canvas point cannot be converted to a map point.
Definition at line 36 of file qgsplottool.cpp.
◆ toolName()
QString QgsPlotTool::toolName |
( |
| ) |
const |
|
inline |
Returns a user-visible, translated name for the tool.
Definition at line 87 of file qgsplottool.h.
◆ wheelEvent()
void QgsPlotTool::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
virtual |
Mouse wheel 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.
Definition at line 122 of file qgsplottool.cpp.
◆ mAction
QPointer< QAction > QgsPlotTool::mAction |
|
protected |
Optional action associated with tool.
Definition at line 273 of file qgsplottool.h.
◆ mCanvas
◆ mCursor
QCursor QgsPlotTool::mCursor = Qt::ArrowCursor |
|
protected |
◆ mToolName
QString QgsPlotTool::mToolName |
|
protected |
The documentation for this class was generated from the following files: