QgsLayoutViewRubberBand class
QgsLayoutViewRubberBand is an abstract base class for temporary rubber band items in various shapes, for use within QgsLayoutView widgets.
Contents
Derived classes
- class QgsLayoutViewEllipticalRubberBand
- QgsLayoutViewEllipseRubberBand is elliptical rubber band for use within QgsLayoutView widgets.
- class QgsLayoutViewRectangularRubberBand
- QgsLayoutViewRectangularRubberBand is rectangular rubber band for use within QgsLayoutView widgets.
- class QgsLayoutViewTriangleRubberBand
- QgsLayoutViewTriangleRubberBand is triangular rubber band for use within QgsLayoutView widgets.
Constructors, destructors, conversion operators
- QgsLayoutViewRubberBand(QgsLayoutView* view = nullptr)
- Constructor for QgsLayoutViewRubberBand.
Public functions
- auto brush() const -> QBrush
- Returns the brush used for drawing the rubber band.
- auto create(QgsLayoutView* view) const -> QgsLayoutViewRubberBand* pure virtual
- Creates a new instance of the QgsLayoutViewRubberBand subclass.
- auto finish(QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = nullptr) -> QRectF pure virtual
- Called when a rubber band use has finished and the rubber band is no longer required.
- auto layout() const -> QgsLayout*
- Returns the layout associated with the rubber band.
- auto pen() const -> QPen
- 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.
- void 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).
- void 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).
- auto view() const -> QgsLayoutView*
- Returns the view associated with the rubber band.
Signals
- void sizeChanged(const QString& size)
- Emitted when the size of the rubber band is changed.
Protected functions
- auto updateRect(QPointF start, QPointF position, bool constrainSquare, bool fromCenter) -> QRectF
- Calculates an updated bounding box rectangle from a original start position and new position.
Function documentation
QBrush QgsLayoutViewRubberBand:: brush() const
Returns the brush used for drawing the rubber band.
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.
QPen QgsLayoutViewRubberBand:: pen() const
Returns the pen used for drawing the rubber band.
void QgsLayoutViewRubberBand:: setBrush(const QBrush& brush)
Sets the brush used for drawing the rubber band.
void QgsLayoutViewRubberBand:: setPen(const QPen& pen)
Sets the pen used for drawing the rubber band.
QgsLayoutView* QgsLayoutViewRubberBand:: view() const
Returns the view associated with the rubber band.
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).
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.