nodedge.graphics_view¶
Graphics View module containing GraphicsView
and DragMode
classes.
-
nodedge.graphics_view.
EDGE_START_DRAG_THRESHOLD
= 40¶ Distance when click on socket to enable Drag Edge
-
class
nodedge.graphics_view.
GraphicsView
(graphicsScene: nodedge.graphics_scene.GraphicsScene, parent: Optional[PySide2.QtWidgets.QWidget] = None)¶ Bases:
PySide2.QtWidgets.QGraphicsView
GraphicsView
class.- Parameters
graphicsScene (
GraphicsScene
) – reference to theGraphicsScene
parent (
Optional[QWidget]
) – parent widget
-
scenePosChanged
= <PySide2.QtCore.Signal object>¶ Signal emitted when cursor position on the Scene has changed
-
initUI
()¶ Set up this
GraphicsView
.
-
dragEnterEvent
(event: PySide2.QtGui.QDragEnterEvent) → None¶ Handle Qt’s mouse’s drag enter event.
Call all the listeners of that event.
- Parameters
event (
QDragEnterEvent.py
) – Mouse drag enter event
-
dropEvent
(event: PySide2.QtGui.QDropEvent) → None¶ Handle Qt’s mouse’s drop event.
Call all the listeners of that event.
- Parameters
event (
QDropEvent.py
) – Mouse drop event
-
addDragEnterListener
(callback: Callable[PySide2.QtGui.QDragEnterEvent, None])¶ Register callback for Drag Enter event.
- Parameters
callback – callback function
-
addDropListener
(callback: Callable[PySide2.QtGui.QDropEvent, None])¶ Register callback for Drop event.
- Parameters
callback – callback function
-
mousePressEvent
(event: PySide2.QtGui.QMouseEvent)¶ Dispatch Qt’s mousePressEvent to corresponding function below.
-
mouseReleaseEvent
(event: PySide2.QtGui.QMouseEvent)¶ Dispatch Qt’s mouseReleaseEvent to corresponding function below.
-
leftMouseButtonPress
(event: PySide2.QtGui.QMouseEvent)¶ Handle when the left mouse button is pressed.
-
leftMouseButtonRelease
(event: PySide2.QtGui.QMouseEvent)¶ Handle when left mouse button is released.
-
middleMouseButtonPress
(event: PySide2.QtGui.QMouseEvent)¶ Handle when middle mouse button is pressed.
-
middleMouseButtonRelease
(event: PySide2.QtGui.QMouseEvent)¶ Handle when middle mouse button is released.
-
rightMouseButtonPress
(event: PySide2.QtGui.QMouseEvent)¶ Handle when right mouse button was pressed
-
rightMouseButtonRelease
(event: PySide2.QtGui.QMouseEvent)¶ Handle when right mouse button is released.
-
mouseMoveEvent
(event: PySide2.QtGui.QMouseEvent) → None¶ Overridden Qt’s
mouseMoveEvent
handling Scene/View logic- Parameters
event (
QMouseEvent.py
) – Qt’s mouse event
-
keyPressEvent
(event: PySide2.QtGui.QKeyEvent) → None¶ Handle key shortcuts, for example to display the scene’s history in the console.
- Parameters
event (
QKeyEvent.py
) – Qt’s Key event
-
wheelEvent
(event)¶ Overridden Qt’s
wheelEvent
. This handles zooming.
-
updateZoom
(zoomIn: bool = True)¶
-
getItemAtClick
(event: PySide2.QtGui.QMouseEvent)¶ Return the object on which the user clicked/released the mouse button.
- Parameters
event (
QMouseEvent.py
) – Qt’s mouse or key event- Returns
Graphical item present at the clicked/released position.
- Return type
QGraphicsItem
|None
-
distanceBetweenClickAndReleaseIsOff
(event: PySide2.QtGui.QMouseEvent) → bool¶ Measure if we are too far from the last mouse button click scene position. This is used for detection if the release is too far after the user clicked on a
Socket
- Parameters
event (
QMouseEvent.py
) – Qt’s mouse event- Returns
True
if we released too far from where we clicked before,False
otherwise.- Return type
bool
-
static
debugModifiers
(event: PySide2.QtGui.QMouseEvent) → str¶ Get the name of the pressed modifier.
- Returns
“CTRL” / “SHIFT” / “ALT”
- Return type
str
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶