QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Plot canvas is a class for displaying interactive 2d charts and plots. More...
#include <qgsplotcanvas.h>
Public Slots | |
virtual void | refresh () |
Updates and redraws the plot. More... | |
Signals | |
void | contextMenuAboutToShow (QMenu *menu, QgsPlotMouseEvent *event) |
Emitted before the canvas context menu will be shown. More... | |
void | plotAreaChanged () |
Emitted whenever the visible area of the plot is changed. More... | |
void | toolChanged (QgsPlotTool *newTool) |
Emitted when the plot tool is changed. More... | |
void | willBeDeleted () |
Emitted in the destructor when the canvas is about to be deleted, but is still in a perfectly valid state. More... | |
Public Member Functions | |
QgsPlotCanvas (QWidget *parent=nullptr) | |
Constructor for QgsPlotCanvas, with the specified parent widget. More... | |
~QgsPlotCanvas () override | |
virtual void | cancelJobs () |
Cancel any rendering job, in a blocking way. More... | |
virtual void | centerPlotOn (double x, double y) |
Centers the plot on the plot point corresponding to x, y in canvas units. More... | |
virtual QgsCoordinateReferenceSystem | crs () const |
Returns the coordinate reference system (CRS) for map coordinates used by the canvas. More... | |
virtual void | panContentsBy (double dx, double dy) |
Pans the plot contents by dx, dy in canvas units. More... | |
virtual void | scalePlot (double factor) |
Scales the plot by a specified scale factor. More... | |
void | setTool (QgsPlotTool *tool) |
Sets the interactive tool currently being used on the canvas. More... | |
virtual QgsPointXY | snapToPlot (QPoint point) |
Snap a canvas point to the plot. More... | |
virtual QgsPointXY | toCanvasCoordinates (const QgsPoint &point) const |
Converts a point in map coordinates to the associated canvas point. More... | |
virtual QgsPoint | toMapCoordinates (const QgsPointXY &point) const |
Converts a point on the canvas to the associated map coordinate. More... | |
QgsPlotTool * | tool () |
Returns the currently active tool. More... | |
void | unsetTool (QgsPlotTool *tool) |
Unset the current tool. More... | |
virtual void | zoomToRect (const QRectF &rect) |
Zooms the plot to the specified rect in canvas units. More... | |
Protected Member Functions | |
bool | event (QEvent *e) override |
void | keyPressEvent (QKeyEvent *e) override |
void | keyReleaseEvent (QKeyEvent *e) override |
void | mouseDoubleClickEvent (QMouseEvent *e) override |
void | mouseMoveEvent (QMouseEvent *e) override |
void | mousePressEvent (QMouseEvent *e) override |
void | mouseReleaseEvent (QMouseEvent *e) override |
void | resizeEvent (QResizeEvent *e) override |
bool | viewportEvent (QEvent *event) override |
void | wheelEvent (QWheelEvent *e) override |
virtual void | wheelZoom (QWheelEvent *event) |
Zoom plot from a mouse wheel event. More... | |
Plot canvas is a class for displaying interactive 2d charts and plots.
Definition at line 53 of file qgsplotcanvas.h.
QgsPlotCanvas::QgsPlotCanvas | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsPlotCanvas, with the specified parent widget.
Definition at line 30 of file qgsplotcanvas.cpp.
|
override |
Definition at line 51 of file qgsplotcanvas.cpp.
|
virtual |
Cancel any rendering job, in a blocking way.
Used for application closing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 79 of file qgsplotcanvas.cpp.
|
virtual |
Centers the plot on the plot point corresponding to x, y in canvas units.
The default implementation does nothing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 282 of file qgsplotcanvas.cpp.
|
signal |
Emitted before the canvas context menu will be shown.
Can be used to extend the context menu.
|
virtual |
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
May return an invalid CRS if no CRS is associated with the canvas.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 262 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 316 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 104 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 129 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 140 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 216 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 153 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 184 of file qgsplotcanvas.cpp.
|
virtual |
Pans the plot contents by dx, dy in canvas units.
The default implementation does nothing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 277 of file qgsplotcanvas.cpp.
|
signal |
Emitted whenever the visible area of the plot is changed.
|
virtualslot |
Updates and redraws the plot.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 84 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 197 of file qgsplotcanvas.cpp.
|
virtual |
Scales the plot by a specified scale factor.
The default implementation does nothing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 287 of file qgsplotcanvas.cpp.
void QgsPlotCanvas::setTool | ( | QgsPlotTool * | tool | ) |
Sets the interactive tool currently being used on the canvas.
Definition at line 229 of file qgsplotcanvas.cpp.
|
virtual |
Snap a canvas point to the plot.
Returns an empty point if snapping was not possible.
point | point in canvas coordinates |
Reimplemented in QgsElevationProfileCanvas.
Definition at line 297 of file qgsplotcanvas.cpp.
|
virtual |
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.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 272 of file qgsplotcanvas.cpp.
|
virtual |
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.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 267 of file qgsplotcanvas.cpp.
QgsPlotTool * QgsPlotCanvas::tool | ( | ) |
Returns the currently active tool.
Definition at line 257 of file qgsplotcanvas.cpp.
|
signal |
Emitted when the plot tool is changed.
void QgsPlotCanvas::unsetTool | ( | QgsPlotTool * | tool | ) |
Unset the current tool.
This is called from destructor of plot tools to make sure that this map tool won't be used any more.
You don't have to call it manually, QgsPlotTool takes care of it.
Definition at line 247 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 302 of file qgsplotcanvas.cpp.
|
overrideprotected |
Definition at line 202 of file qgsplotcanvas.cpp.
|
protectedvirtual |
Zoom plot from a mouse wheel event.
The default implementation does nothing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 311 of file qgsplotcanvas.cpp.
|
signal |
Emitted in the destructor when the canvas is about to be deleted, but is still in a perfectly valid state.
|
virtual |
Zooms the plot to the specified rect in canvas units.
The default implementation does nothing.
Reimplemented in QgsElevationProfileCanvas.
Definition at line 292 of file qgsplotcanvas.cpp.