QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | Protected Member Functions | List of all members
QgsPlotRubberBand Class Referenceabstract

QgsPlotRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsPlotCanvas widgets. More...

#include <qgsplotrubberband.h>

Inheritance diagram for QgsPlotRubberBand:
Inheritance graph
[legend]

Public Member Functions

 QgsPlotRubberBand (QgsPlotCanvas *canvas=nullptr)
 Constructor for QgsPlotRubberBand. More...
 
 ~QgsPlotRubberBand () override=default
 
QBrush brush () const
 Returns the brush used for drawing the rubber band. More...
 
QgsPlotCanvascanvas () const
 Returns the canvas associated with the rubber band. More...
 
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. More...
 
QPen pen () const
 Returns the pen used for drawing the rubber band. More...
 
void setBrush (const QBrush &brush)
 Sets the brush used for drawing the rubber band. More...
 
void setPen (const QPen &pen)
 Sets the pen used for drawing the rubber band. More...
 
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). More...
 
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). More...
 

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. More...
 

Detailed Description

QgsPlotRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsPlotCanvas widgets.

Since
QGIS 3.26

Definition at line 38 of file qgsplotrubberband.h.

Constructor & Destructor Documentation

◆ QgsPlotRubberBand()

QgsPlotRubberBand::QgsPlotRubberBand ( QgsPlotCanvas canvas = nullptr)

Constructor for QgsPlotRubberBand.

Definition at line 25 of file qgsplotrubberband.cpp.

◆ ~QgsPlotRubberBand()

QgsPlotRubberBand::~QgsPlotRubberBand ( )
overridedefault

Member Function Documentation

◆ brush()

QBrush QgsPlotRubberBand::brush ( ) const

Returns the brush used for drawing the rubber band.

See also
setBrush()
pen()

Definition at line 109 of file qgsplotrubberband.cpp.

◆ canvas()

QgsPlotCanvas * QgsPlotRubberBand::canvas ( ) const

Returns the canvas associated with the rubber band.

Definition at line 31 of file qgsplotrubberband.cpp.

◆ finish()

virtual QRectF QgsPlotRubberBand::finish ( QPointF  position = QPointF(),
Qt::KeyboardModifiers  modifiers = Qt::KeyboardModifiers() 
)
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.

◆ pen()

QPen QgsPlotRubberBand::pen ( ) const

Returns the pen used for drawing the rubber band.

See also
setPen()
brush()

Definition at line 99 of file qgsplotrubberband.cpp.

◆ setBrush()

void QgsPlotRubberBand::setBrush ( const QBrush &  brush)

Sets the brush used for drawing the rubber band.

See also
brush()
setPen()

Definition at line 114 of file qgsplotrubberband.cpp.

◆ setPen()

void QgsPlotRubberBand::setPen ( const QPen &  pen)

Sets the pen used for drawing the rubber band.

See also
pen()
setBrush()

Definition at line 104 of file qgsplotrubberband.cpp.

◆ start()

virtual void QgsPlotRubberBand::start ( QPointF  position,
Qt::KeyboardModifiers  modifiers 
)
pure virtual

Called when a rubber band should be created at the specified starting position (in canvas coordinate space).

Implemented in QgsPlotRectangularRubberBand.

◆ update()

virtual void QgsPlotRubberBand::update ( QPointF  position,
Qt::KeyboardModifiers  modifiers 
)
pure virtual

Called when a rubber band should be updated to reflect a temporary ending position (in canvas coordinate space).

Implemented in QgsPlotRectangularRubberBand.

◆ updateRect()

QRectF QgsPlotRubberBand::updateRect ( QPointF  start,
QPointF  position,
bool  constrainSquare,
bool  fromCenter 
)
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 36 of file qgsplotrubberband.cpp.


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