QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | List of all members
QgsModelViewRubberBand Class Referenceabstract

QgsModelViewRubberBand is 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:
Inheritance graph
[legend]

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

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

Since
QGIS 3.14

Definition at line 38 of file qgsmodelviewrubberband.h.

Constructor & Destructor Documentation

◆ QgsModelViewRubberBand()

QgsModelViewRubberBand::QgsModelViewRubberBand ( QgsModelGraphicsView *  view = nullptr)

Constructor for QgsModelViewRubberBand.

Definition at line 22 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 106 of file qgsmodelviewrubberband.cpp.

◆ create()

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

Creates a new instance of the QgsModelViewRubberBand subclass.

Implemented in 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 QgsModelViewRectangularRubberBand.

◆ pen()

QPen QgsModelViewRubberBand::pen ( ) const

Returns the pen used for drawing the rubber band.

See also
setPen()
brush()

Definition at line 96 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 111 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 101 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 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 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 33 of file qgsmodelviewrubberband.cpp.

◆ view()

QgsModelGraphicsView * QgsModelViewRubberBand::view ( ) const

Returns the view associated with the rubber band.

Definition at line 28 of file qgsmodelviewrubberband.cpp.


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