QGraphicsSceneContextMenuEvent

The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. More

Inheritance diagram of PySide2.QtWidgets.QGraphicsSceneContextMenuEvent

Synopsis

Functions

Detailed Description

A QContextMenuEvent received by a QGraphicsView is translated into a QGraphicsSceneContextMenuEvent . The globalPos() is translated into item, scene, and screen coordinates ( pos() , scenePos() , and screenPos() ).

class PySide2.QtWidgets.QGraphicsSceneContextMenuEvent([type=None])
param type:

Type

Constructs a graphics scene context menu event of the specified type .

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.Reason

This enum describes the reason why the context event was sent.

Constant

Description

QGraphicsSceneContextMenuEvent.Mouse

The mouse caused the event to be sent. On most platforms, this means the right mouse button was clicked.

QGraphicsSceneContextMenuEvent.Keyboard

The keyboard caused this event to be sent. On Windows and macOS, this means the menu button was pressed.

QGraphicsSceneContextMenuEvent.Other

The event was sent by some other means (i.e. not by the mouse or keyboard).

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.modifiers()
Return type:

KeyboardModifiers

Returns the keyboard modifiers in use when the context menu was requested.

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.pos()
Return type:

PySide2.QtCore.QPointF

Returns the position of the mouse cursor in item coordinates at the moment the context menu was requested.

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.reason()
Return type:

Reason

Returns the reason for the context menu event.

See also

Reason

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.scenePos()
Return type:

PySide2.QtCore.QPointF

Returns the position of the mouse cursor in scene coordinates at the moment the context menu was requested.

See also

pos() screenPos()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.screenPos()
Return type:

PySide2.QtCore.QPoint

Returns the position of the mouse cursor in screen coordinates at the moment the context menu was requested.

See also

pos() scenePos()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.setModifiers(modifiers)
Parameters:

modifiersKeyboardModifiers

Sets the keyboard modifiers associated with the context menu to the modifiers specified.

See also

modifiers()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.setPos(pos)
Parameters:

posPySide2.QtCore.QPointF

See also

pos()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.setReason(reason)
Parameters:

reasonReason

Sets the reason for the context menu event to reason .

See also

reason()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.setScenePos(pos)
Parameters:

posPySide2.QtCore.QPointF

See also

scenePos()

PySide2.QtWidgets.QGraphicsSceneContextMenuEvent.setScreenPos(pos)
Parameters:

posPySide2.QtCore.QPoint

See also

screenPos()