Subgroup: Layout
Class: QgsLayoutViewMouseEvent¶
-
class
qgis.gui.
QgsLayoutViewMouseEvent
(view: QgsLayoutView, event: QMouseEvent, snap: bool = False)¶ Bases:
PyQt5.QtGui.QMouseEvent
Constructor for QgsLayoutViewMouseEvent. Should only be required to be called from the QgsLayoutView.
Parameters: - view – The view in which the event occurred.
- event – The original mouse event
- snap – set to true to snap the point using the layout’s snapping settings
QgsLayoutViewMouseEvent(QgsLayoutViewMouseEvent)
A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on a QgsLayoutView.
It is sent whenever the user moves, clicks, releases or double clicks the mouse. In addition to the coordinates in pixel space it also knows the coordinates the layout space.
New in version 3.0: Methods
isSnapped
Returns true if point was snapped, e. layoutPoint
Returns the event point location in layout coordinates. snapPoint
Manually triggers a snap for the mouse event position using the layout’s snapper. snappedPoint
Returns the snapped event point location in layout coordinates. Signals
Attributes
-
isSnapped
(self) → bool¶ Returns true if point was snapped, e.g. to grid or guide lines.
See also
-
layoutPoint
(self) → QPointF¶ Returns the event point location in layout coordinates.
See also
pos()
-
snapPoint
(self, horizontalSnapLine: QGraphicsLineItem = None, verticalSnapLine: QGraphicsLineItem = None, ignoreItems: Iterable[QgsLayoutItem] = [])¶ Manually triggers a snap for the mouse event position using the layout’s snapper.
If the
horizontalSnapLine
andverticalSnapLine
arguments are specified, then the snapper will automatically display and position these lines to indicate snapping positions to item bounds.The
ignoreItems
argument can be used to specify a list of items to avoid snapping to.
-
snappedPoint
(self) → QPointF¶ Returns the snapped event point location in layout coordinates. The snapped point will consider all possible snapping methods, such as snapping to grid or guide lines.
See also
See also
pos()