QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | List of all members
QgsLayoutViewRubberBand Class Referenceabstract

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

#include <qgslayoutviewrubberband.h>

Inheritance diagram for QgsLayoutViewRubberBand:
Inheritance graph
[legend]

Signals

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

Public Member Functions

 QgsLayoutViewRubberBand (QgsLayoutView *view=nullptr)
 Constructor for QgsLayoutViewRubberBand.
 
 ~QgsLayoutViewRubberBand () override=default
 
QBrush brush () const
 Returns the brush used for drawing the rubber band.
 
virtual QgsLayoutViewRubberBandcreate (QgsLayoutView *view) const =0
 Creates a new instance of the QgsLayoutViewRubberBand 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.
 
QgsLayoutlayout () const
 Returns the layout associated with the rubber band.
 
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 layout 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 layout coordinate space).
 
QgsLayoutViewview () 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

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

Definition at line 36 of file qgslayoutviewrubberband.h.

Constructor & Destructor Documentation

◆ QgsLayoutViewRubberBand()

QgsLayoutViewRubberBand::QgsLayoutViewRubberBand ( QgsLayoutView view = nullptr)

Constructor for QgsLayoutViewRubberBand.

Definition at line 26 of file qgslayoutviewrubberband.cpp.

◆ ~QgsLayoutViewRubberBand()

QgsLayoutViewRubberBand::~QgsLayoutViewRubberBand ( )
overridedefault

Member Function Documentation

◆ brush()

QBrush QgsLayoutViewRubberBand::brush ( ) const

Returns the brush used for drawing the rubber band.

See also
setBrush()
pen()

Definition at line 115 of file qgslayoutviewrubberband.cpp.

◆ create()

virtual QgsLayoutViewRubberBand * QgsLayoutViewRubberBand::create ( QgsLayoutView view) const
pure virtual

◆ finish()

virtual QRectF QgsLayoutViewRubberBand::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 QgsLayoutViewRectangularRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewTriangleRubberBand.

◆ layout()

QgsLayout * QgsLayoutViewRubberBand::layout ( ) const

Returns the layout associated with the rubber band.

See also
view()

Definition at line 37 of file qgslayoutviewrubberband.cpp.

◆ pen()

QPen QgsLayoutViewRubberBand::pen ( ) const

Returns the pen used for drawing the rubber band.

See also
setPen()
brush()

Definition at line 105 of file qgslayoutviewrubberband.cpp.

◆ setBrush()

void QgsLayoutViewRubberBand::setBrush ( const QBrush &  brush)

Sets the brush used for drawing the rubber band.

See also
brush()
setPen()

Definition at line 120 of file qgslayoutviewrubberband.cpp.

◆ setPen()

void QgsLayoutViewRubberBand::setPen ( const QPen &  pen)

Sets the pen used for drawing the rubber band.

See also
pen()
setBrush()

Definition at line 110 of file qgslayoutviewrubberband.cpp.

◆ sizeChanged

void QgsLayoutViewRubberBand::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 QgsLayoutViewRubberBand::start ( QPointF  position,
Qt::KeyboardModifiers  modifiers 
)
pure virtual

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

Implemented in QgsLayoutViewRectangularRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewTriangleRubberBand.

◆ update()

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

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

Implemented in QgsLayoutViewRectangularRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewTriangleRubberBand.

◆ updateRect()

QRectF QgsLayoutViewRubberBand::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 42 of file qgslayoutviewrubberband.cpp.

◆ view()

QgsLayoutView * QgsLayoutViewRubberBand::view ( ) const

Returns the view associated with the rubber band.

See also
layout()

Definition at line 32 of file qgslayoutviewrubberband.cpp.


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