QGraphicsSceneMouseEvent#

The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework. More

Inheritance diagram of PySide6.QtWidgets.QGraphicsSceneMouseEvent

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

When a QGraphicsView receives a QMouseEvent , it translates it to a QGraphicsSceneMouseEvent . The event is then forwarded to the QGraphicsScene associated with the view. If the event is not handled by the scene, the view may use it, e.g., for the DragMode .

In addition to containing the item, scene, and screen coordinates of the event (as pos() , scenePos() , and screenPos() ), mouse events also contain the coordinates of the previous mouse event received by the view. These can be retrieved with lastPos() , lastScreenPos() , and lastScenePos() .

class PySide6.QtWidgets.QGraphicsSceneMouseEvent([type=QEvent.Type.None])#
Parameters:

typeType

PySide6.QtWidgets.QGraphicsSceneMouseEvent.button()#
Return type:

MouseButton

Returns the mouse button (if any) that caused the event.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.buttonDownPos(button)#
Parameters:

buttonMouseButton

Return type:

PySide6.QtCore.QPointF

Returns the mouse cursor position in item coordinates where the specified button was clicked.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.buttonDownScenePos(button)#
Parameters:

buttonMouseButton

Return type:

PySide6.QtCore.QPointF

Returns the mouse cursor position in scene coordinates where the specified button was clicked.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.buttonDownScreenPos(button)#
Parameters:

buttonMouseButton

Return type:

PySide6.QtCore.QPoint

Returns the mouse cursor position in screen coordinates where the specified button was clicked.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.buttons()#
Return type:

MouseButtons

Returns the combination of mouse buttons that were pressed at the time the event was sent.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.flags()#
Return type:

MouseEventFlags

Returns the mouse event flags.

The mouse event flags provide additional information about a mouse event.

See also

MouseEventFlag flags()

PySide6.QtWidgets.QGraphicsSceneMouseEvent.lastPos()#
Return type:

PySide6.QtCore.QPointF

Returns the last recorded mouse cursor position in item coordinates.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.lastScenePos()#
Return type:

PySide6.QtCore.QPointF

Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.lastScreenPos()#
Return type:

PySide6.QtCore.QPoint

Returns the last recorded mouse cursor position in screen coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.modifiers()#
Return type:

KeyboardModifiers

Returns the keyboard modifiers in use at the time the event was sent.

See also

buttons() button()

PySide6.QtWidgets.QGraphicsSceneMouseEvent.pos()#
Return type:

PySide6.QtCore.QPointF

Returns the mouse cursor position in item coordinates.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.scenePos()#
Return type:

PySide6.QtCore.QPointF

Returns the mouse cursor position in scene coordinates.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.screenPos()#
Return type:

PySide6.QtCore.QPoint

Returns the mouse cursor position in screen coordinates.

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setButton(button)#
Parameters:

buttonMouseButton

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setButtonDownPos(button, pos)#
Parameters:
PySide6.QtWidgets.QGraphicsSceneMouseEvent.setButtonDownScenePos(button, pos)#
Parameters:
PySide6.QtWidgets.QGraphicsSceneMouseEvent.setButtonDownScreenPos(button, pos)#
Parameters:
PySide6.QtWidgets.QGraphicsSceneMouseEvent.setButtons(buttons)#
Parameters:

buttonsMouseButtons

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setFlags(arg__1)#
Parameters:

arg__1MouseEventFlags

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setLastPos(pos)#
Parameters:

posPySide6.QtCore.QPointF

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setLastScenePos(pos)#
Parameters:

posPySide6.QtCore.QPointF

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setLastScreenPos(pos)#
Parameters:

posPySide6.QtCore.QPoint

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setModifiers(modifiers)#
Parameters:

modifiersKeyboardModifiers

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setPos(pos)#
Parameters:

posPySide6.QtCore.QPointF

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setScenePos(pos)#
Parameters:

posPySide6.QtCore.QPointF

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setScreenPos(pos)#
Parameters:

posPySide6.QtCore.QPoint

PySide6.QtWidgets.QGraphicsSceneMouseEvent.setSource(source)#
Parameters:

sourceMouseEventSource

PySide6.QtWidgets.QGraphicsSceneMouseEvent.source()#
Return type:

MouseEventSource

Returns information about the mouse event source.

The mouse event source can be used to distinguish between genuine and artificial mouse events. The latter are events that are synthesized from touch events by the operating system or Qt itself.

See also

MouseEventSource source()