QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
QgsPlotRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsPlotCanvas widgets. More...
#include <qgsplotrubberband.h>
Public Member Functions | |
QgsPlotRubberBand (QgsPlotCanvas *canvas=nullptr) | |
Constructor for QgsPlotRubberBand. | |
~QgsPlotRubberBand () override=default | |
QBrush | brush () const |
Returns the brush used for drawing the rubber band. | |
QgsPlotCanvas * | canvas () const |
Returns the canvas associated with the rubber band. | |
virtual QRectF | finish (QPointF position=QPointF(), Qt::KeyboardModifiers modifiers=Qt::KeyboardModifiers())=0 |
Called when a rubber band use has finished and the rubber band is no longer required. | |
QPen | pen () const |
Returns the pen used for drawing the rubber band. | |
void | setBrush (const QBrush &brush) |
Sets the brush used for drawing the rubber band. | |
void | setPen (const QPen &pen) |
Sets the pen used for drawing the rubber band. | |
virtual void | start (QPointF position, Qt::KeyboardModifiers modifiers)=0 |
Called when a rubber band should be created at the specified starting position (in canvas coordinate space). | |
virtual void | update (QPointF position, Qt::KeyboardModifiers modifiers)=0 |
Called when a rubber band should be updated to reflect a temporary ending position (in canvas coordinate space). | |
Protected Member Functions | |
QRectF | updateRect (QPointF start, QPointF position, bool constrainSquare, bool fromCenter) |
Calculates an updated bounding box rectangle from a original start position and new position. | |
QgsPlotRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsPlotCanvas widgets.
Definition at line 38 of file qgsplotrubberband.h.
QgsPlotRubberBand::QgsPlotRubberBand | ( | QgsPlotCanvas * | canvas = nullptr | ) |
Constructor for QgsPlotRubberBand.
Definition at line 26 of file qgsplotrubberband.cpp.
|
overridedefault |
QBrush QgsPlotRubberBand::brush | ( | ) | const |
Returns the brush used for drawing the rubber band.
Definition at line 110 of file qgsplotrubberband.cpp.
QgsPlotCanvas * QgsPlotRubberBand::canvas | ( | ) | const |
Returns the canvas associated with the rubber band.
Definition at line 32 of file qgsplotrubberband.cpp.
|
pure virtual |
Called when a rubber band use has finished and the rubber band is no longer required.
Returns the final bounding box of the rubber band.
Implemented in QgsPlotRectangularRubberBand.
QPen QgsPlotRubberBand::pen | ( | ) | const |
Returns the pen used for drawing the rubber band.
Definition at line 100 of file qgsplotrubberband.cpp.
void QgsPlotRubberBand::setBrush | ( | const QBrush & | brush | ) |
Sets the brush used for drawing the rubber band.
Definition at line 115 of file qgsplotrubberband.cpp.
void QgsPlotRubberBand::setPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing the rubber band.
Definition at line 105 of file qgsplotrubberband.cpp.
|
pure virtual |
Called when a rubber band should be created at the specified starting position (in canvas coordinate space).
Implemented in QgsPlotRectangularRubberBand.
|
pure virtual |
Called when a rubber band should be updated to reflect a temporary ending position (in canvas coordinate space).
Implemented in QgsPlotRectangularRubberBand.
|
protected |
Calculates an updated bounding box rectangle from a original start position and new position.
If constrainSquare is true
then the bounding box will be forced to a square shape. If fromCenter is true
then the original start position will form the center point of the returned rectangle.
Definition at line 37 of file qgsplotrubberband.cpp.