- class QGraphicsSceneMouseEvent¶
The
QGraphicsSceneMouseEvent
class provides mouse events in the graphics view framework. More…Synopsis¶
Methods¶
def
__init__()
def
button()
def
buttonDownPos()
def
buttons()
def
flags()
def
lastPos()
def
lastScenePos()
def
lastScreenPos()
def
modifiers()
def
pos()
def
scenePos()
def
screenPos()
def
setButton()
def
setButtons()
def
setFlags()
def
setLastPos()
def
setModifiers()
def
setPos()
def
setScenePos()
def
setScreenPos()
def
setSource()
def
source()
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 aQGraphicsSceneMouseEvent
. The event is then forwarded to theQGraphicsScene
associated with the view. If the event is not handled by the scene, the view may use it, e.g., for theDragMode
.In addition to containing the item, scene, and screen coordinates of the event (as
pos()
,scenePos()
, andscreenPos()
), mouse events also contain the coordinates of the previous mouse event received by the view. These can be retrieved withlastPos()
,lastScreenPos()
, andlastScenePos()
.- button()¶
- Return type:
Returns the mouse button (if any) that caused the event.
See also
- buttonDownPos(button)¶
- Parameters:
button –
MouseButton
- Return type:
Returns the mouse cursor position in item coordinates where the specified
button
was clicked.- buttonDownScenePos(button)¶
- Parameters:
button –
MouseButton
- Return type:
Returns the mouse cursor position in scene coordinates where the specified
button
was clicked.- buttonDownScreenPos(button)¶
- Parameters:
button –
MouseButton
- Return type:
Returns the mouse cursor position in screen coordinates where the specified
button
was clicked.- buttons()¶
- Return type:
Combination of
MouseButton
Returns the combination of mouse buttons that were pressed at the time the event was sent.
See also
- flags()¶
- Return type:
Combination of
MouseEventFlag
Returns the mouse event flags.
The mouse event flags provide additional information about a mouse event.
See also
flags()
Returns the last recorded mouse cursor position in item coordinates.
See also
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.
See also
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.
See also
- modifiers()¶
- Return type:
Combination of
KeyboardModifier
Returns the keyboard modifiers in use at the time the event was sent.
Returns the mouse cursor position in item coordinates.
See also
Returns the mouse cursor position in scene coordinates.
See also
Returns the mouse cursor position in screen coordinates.
See also
- setButton(button)¶
- Parameters:
button –
MouseButton
- setButtonDownPos(button, pos)¶
- Parameters:
button –
MouseButton
pos –
QPointF
- setButtonDownScenePos(button, pos)¶
- Parameters:
button –
MouseButton
pos –
QPointF
- setButtonDownScreenPos(button, pos)¶
- Parameters:
button –
MouseButton
pos –
QPoint
- setButtons(buttons)¶
- Parameters:
buttons – Combination of
MouseButton
- setFlags(arg__1)¶
- Parameters:
arg__1 – Combination of
MouseEventFlag
- setModifiers(modifiers)¶
- Parameters:
modifiers – Combination of
KeyboardModifier
- setSource(source)¶
- Parameters:
source –
MouseEventSource
- source()¶
- Return type:
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
source()