Class: QgsPlotRubberBand¶
An abstract base class for temporary rubber band items in various
shapes, for use within QgsPlotCanvas widgets.
Added in version 3.26.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: finish(), start(), update()
Class Hierarchy¶
Base classes¶
Subclasses¶
A rectangular rubber band for use within |
- class qgis.gui.QgsPlotRubberBand[source]¶
Bases:
QObject- __init__(canvas: QgsPlotCanvas | None = None)
Constructor for QgsPlotRubberBand.
- Parameters:
canvas (Optional[QgsPlotCanvas] = None)
- brush(self) QBrush[source]¶
Returns the brush used for drawing the rubber band.
See also
See also
- Return type:
QBrush
- canvas(self) QgsPlotCanvas | None[source]¶
Returns the canvas associated with the rubber band.
- Return type:
Optional[QgsPlotCanvas]
- abstract finish(self, position: QPointF | QPoint = QPointF(), modifiers: Qt.KeyboardModifiers | Qt.KeyboardModifier = Qt.KeyboardModifiers()) QRectF[source]¶
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.
- Parameters:
position (Union[QPointF, QPoint] = QPointF())
modifiers (Union[Qt.KeyboardModifiers, Qt.KeyboardModifier] = Qt.KeyboardModifiers())
- Return type:
QRectF
- pen(self) QPen[source]¶
Returns the pen used for drawing the rubber band.
See also
See also
- Return type:
QPen
- setBrush(self, brush: QBrush | QColor | Qt.GlobalColor | QGradient)[source]¶
Sets the
brushused for drawing the rubber band.See also
See also
- Parameters:
brush (Union[QBrush, Union[QColor, Qt.GlobalColor], QGradient])
- setPen(self, pen: QPen | QColor | Qt.GlobalColor)[source]¶
Sets the
penused for drawing the rubber band.See also
See also
- Parameters:
pen (Union[QPen, Union[QColor, Qt.GlobalColor]])
- abstract start(self, position: QPointF | QPoint, modifiers: Qt.KeyboardModifiers | Qt.KeyboardModifier)[source]¶
Called when a rubber band should be created at the specified starting
position(in canvas coordinate space).- Parameters:
position (Union[QPointF, QPoint])
modifiers (Union[Qt.KeyboardModifiers, Qt.KeyboardModifier])
- abstract update(self, position: QPointF | QPoint, modifiers: Qt.KeyboardModifiers | Qt.KeyboardModifier)[source]¶
Called when a rubber band should be updated to reflect a temporary ending
position(in canvas coordinate space).- Parameters:
position (Union[QPointF, QPoint])
modifiers (Union[Qt.KeyboardModifiers, Qt.KeyboardModifier])
- updateRect(self, start: QPointF | QPoint, position: QPointF | QPoint, constrainSquare: bool, fromCenter: bool) QRectF[source]¶
Calculates an updated bounding box rectangle from a original
startposition and newposition. IfconstrainSquareisTruethen the bounding box will be forced to a square shape. IffromCenterisTruethen the originalstartposition will form the center point of the returned rectangle.- Parameters:
start (Union[QPointF, QPoint])
position (Union[QPointF, QPoint])
constrainSquare (bool)
fromCenter (bool)
- Return type:
QRectF