QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsModelViewRubberBand Class Referenceabstract

An abstract base class for temporary rubber band items in various shapes, for use within QgsModelGraphicsView widgets. More...

#include <qgsmodelviewrubberband.h>

Inheritance diagram for QgsModelViewRubberBand:

Signals

void sizeChanged (const QString &size)
 Emitted when the size of the rubber band is changed.

Public Member Functions

 QgsModelViewRubberBand (QgsModelGraphicsView *view=nullptr)
 Constructor for QgsModelViewRubberBand.
 ~QgsModelViewRubberBand () override=default
QBrush brush () const
 Returns the brush used for drawing the rubber band.
virtual QgsModelViewRubberBandcreate (QgsModelGraphicsView *view) const =0
 Creates a new instance of the QgsModelViewRubberBand subclass.
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 model 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 model coordinate space).
QgsModelGraphicsView * view () const
 Returns the view associated with the rubber band.

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.

Detailed Description

An abstract base class for temporary rubber band items in various shapes, for use within QgsModelGraphicsView widgets.

Since
QGIS 3.14

Definition at line 40 of file qgsmodelviewrubberband.h.

Constructor & Destructor Documentation

◆ QgsModelViewRubberBand()

QgsModelViewRubberBand::QgsModelViewRubberBand ( QgsModelGraphicsView * view = nullptr)

Constructor for QgsModelViewRubberBand.

Definition at line 26 of file qgsmodelviewrubberband.cpp.

◆ ~QgsModelViewRubberBand()

QgsModelViewRubberBand::~QgsModelViewRubberBand ( )
overridedefault

Member Function Documentation

◆ brush()

QBrush QgsModelViewRubberBand::brush ( ) const

Returns the brush used for drawing the rubber band.

See also
setBrush()
pen()

Definition at line 109 of file qgsmodelviewrubberband.cpp.

◆ create()

virtual QgsModelViewRubberBand * QgsModelViewRubberBand::create ( QgsModelGraphicsView * view) const
pure virtual

Creates a new instance of the QgsModelViewRubberBand subclass.

Implemented in QgsModelViewBezierRubberBand, and QgsModelViewRectangularRubberBand.

◆ finish()

virtual QRectF QgsModelViewRubberBand::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 QgsModelViewBezierRubberBand, and QgsModelViewRectangularRubberBand.

◆ pen()

QPen QgsModelViewRubberBand::pen ( ) const

Returns the pen used for drawing the rubber band.

See also
setPen()
brush()

Definition at line 99 of file qgsmodelviewrubberband.cpp.

◆ setBrush()

void QgsModelViewRubberBand::setBrush ( const QBrush & brush)

Sets the brush used for drawing the rubber band.

See also
brush()
setPen()

Definition at line 114 of file qgsmodelviewrubberband.cpp.

◆ setPen()

void QgsModelViewRubberBand::setPen ( const QPen & pen)

Sets the pen used for drawing the rubber band.

See also
pen()
setBrush()

Definition at line 104 of file qgsmodelviewrubberband.cpp.

◆ sizeChanged

void QgsModelViewRubberBand::sizeChanged ( const QString & size)
signal

Emitted when the size of the rubber band is changed.

The size argument gives a translated string describing the new rubber band size, with a format which differs per subclass (e.g. rectangles may describe a size using width and height, while circles may describe a size by radius).

◆ start()

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

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

Implemented in QgsModelViewBezierRubberBand, and QgsModelViewRectangularRubberBand.

◆ update()

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

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

Implemented in QgsModelViewBezierRubberBand, and QgsModelViewRectangularRubberBand.

◆ updateRect()

QRectF QgsModelViewRubberBand::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 qgsmodelviewrubberband.cpp.

◆ view()

QgsModelGraphicsView * QgsModelViewRubberBand::view ( ) const

Returns the view associated with the rubber band.

Definition at line 31 of file qgsmodelviewrubberband.cpp.


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