QGIS API Documentation  3.6.0-Noosa (5873452)
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. More...
 

Public Member Functions

 QgsLayoutViewRubberBand (QgsLayoutView *view=nullptr)
 Constructor for QgsLayoutViewRubberBand. More...
 
 ~QgsLayoutViewRubberBand () override=default
 
QBrush brush () const
 Returns the brush used for drawing the rubber band. More...
 
virtual QgsLayoutViewRubberBandcreate (QgsLayoutView *view) const =0
 Creates a new instance of the QgsLayoutViewRubberBand subclass. More...
 
virtual QRectF finish (QPointF position=QPointF(), Qt::KeyboardModifiers modifiers=nullptr)=0
 Called when a rubber band use has finished and the rubber band is no longer required. More...
 
QgsLayoutlayout () const
 Returns the layout associated with the rubber band. 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 layout 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 layout coordinate space). More...
 
QgsLayoutViewview () const
 Returns the view associated with the rubber band. 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

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

Since
QGIS 3.0

Definition at line 37 of file qgslayoutviewrubberband.h.

Constructor & Destructor Documentation

◆ QgsLayoutViewRubberBand()

QgsLayoutViewRubberBand::QgsLayoutViewRubberBand ( QgsLayoutView view = nullptr)

Constructor for QgsLayoutViewRubberBand.

Definition at line 24 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 113 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 = nullptr 
)
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 QgsLayoutViewTriangleRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewRectangularRubberBand.

◆ layout()

QgsLayout * QgsLayoutViewRubberBand::layout ( ) const

Returns the layout associated with the rubber band.

See also
view()

Definition at line 35 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 103 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 118 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 108 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 QgsLayoutViewTriangleRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewRectangularRubberBand.

◆ 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 QgsLayoutViewTriangleRubberBand, QgsLayoutViewEllipticalRubberBand, and QgsLayoutViewRectangularRubberBand.

◆ 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 40 of file qgslayoutviewrubberband.cpp.

◆ view()

QgsLayoutView * QgsLayoutViewRubberBand::view ( ) const

Returns the view associated with the rubber band.

See also
layout()

Definition at line 30 of file qgslayoutviewrubberband.cpp.


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