Class: QgsLayoutViewRubberBand

class qgis.gui.QgsLayoutViewRubberBand

Bases: PyQt5.QtCore.QObject

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

New in version 3.0.

QgsLayoutViewRubberBand(view: QgsLayoutView = None) Constructor for QgsLayoutViewRubberBand.

Methods

brush

Returns the brush used for drawing the rubber band.

childEvent

connectNotify

create

Creates a new instance of the QgsLayoutViewRubberBand subclass.

customEvent

disconnectNotify

finish

Called when a rubber band use has finished and the rubber band is no longer required.

isSignalConnected

layout

Returns the layout associated with the rubber band.

pen

Returns the pen used for drawing the rubber band.

receivers

sender

senderSignalIndex

setBrush

Sets the brush used for drawing the rubber band.

setPen

Sets the pen used for drawing the rubber band.

start

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

timerEvent

update

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

updateRect

Calculates an updated bounding box rectangle from a original start position and new position.

view

Returns the view associated with the rubber band.

Signals

sizeChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

brush(self) QBrush

Returns the brush used for drawing the rubber band.

See also

setBrush()

See also

pen()

Return type

QBrush

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
create(self, view: QgsLayoutView) QgsLayoutViewRubberBand

Creates a new instance of the QgsLayoutViewRubberBand subclass.

Parameters

view (QgsLayoutView) –

Return type

QgsLayoutViewRubberBand

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
finish(self, position: Union[QPointF, QPoint] = QPointF(), modifiers: Union[Qt.KeyboardModifiers, Qt.KeyboardModifier] = Qt.KeyboardModifiers()) QRectF

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) –

  • modifiers (Union[Qt.KeyboardModifiers) –

Return type

QRectF

isSignalConnected(self, QMetaMethod) bool
layout(self) QgsLayout

Returns the layout associated with the rubber band.

See also

view()

Return type

QgsLayout

pen(self) QPen

Returns the pen used for drawing the rubber band.

See also

setPen()

See also

brush()

Return type

QPen

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
setBrush(self, brush: Union[QBrush, QColor, Qt.GlobalColor, QGradient])

Sets the brush used for drawing the rubber band.

See also

brush()

See also

setPen()

Parameters

brush (Union[QBrush) –

setPen(self, pen: Union[QPen, QColor, Qt.GlobalColor, QGradient])

Sets the pen used for drawing the rubber band.

See also

pen()

See also

setBrush()

Parameters

pen (Union[QPen) –

sizeChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type

PYQT_SIGNAL

start(self, position: Union[QPointF, QPoint], modifiers: Union[Qt.KeyboardModifiers, Qt.KeyboardModifier])

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

Parameters
  • position (Union[QPointF) –

  • modifiers (Union[Qt.KeyboardModifiers) –

timerEvent(self, QTimerEvent)
update(self, position: Union[QPointF, QPoint], modifiers: Union[Qt.KeyboardModifiers, Qt.KeyboardModifier])

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

Parameters
  • position (Union[QPointF) –

  • modifiers (Union[Qt.KeyboardModifiers) –

updateRect(self, start: Union[QPointF, QPoint], position: Union[QPointF, QPoint], constrainSquare: bool, fromCenter: bool) QRectF

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.

Parameters
  • start (Union[QPointF) –

  • position (Union[QPointF) –

  • constrainSquare (bool) –

  • fromCenter (bool) –

Return type

QRectF

view(self) QgsLayoutView

Returns the view associated with the rubber band.

See also

layout()

Return type

QgsLayoutView