nodedge.graphics_node_content¶
Graphics node content module containing the
GraphicsNodeContent
class.
-
class
nodedge.graphics_node_content.
GraphicsNodeContent
(node: Node, parent: Optional[PySide2.QtWidgets.QWidget] = None)¶ Bases:
PySide2.QtWidgets.QWidget
,nodedge.serializable.Serializable
GraphicsNodeContent
class.Base class for representation of the Node’s graphics content. This class also provides layout for other widgets inside of a
Node
.- Parameters
- Instance Attributes
node - reference to the
Node
layout -
QLayout
container
-
initUI
()¶ Sets up layouts and widgets to be rendered in
QDMGraphicsNode
class.
-
setEditingFlag
(value: bool) → None¶ Note
If you are handling keyPress events by default Qt Window’s shortcuts and
QActions
, you will not probably need to use this methodHelper function which sets editingFlag inside
GraphicsView
class.This is a helper function to handle keys inside nodes with
QLineEdits
orQTextEdits
(you can use overriddenTextEdit
class) and with QGraphicsView class methodkeyPressEvent
.- Parameters
value (
bool
) – new value for editing flag
-
serialize
() → collections.OrderedDict¶ Default serialization method.
It needs to be overridden for each node implementation.
- Return OrderedDict
Serialized data as ordered dictionary
-
deserialize
(data: dict, hashmap: Optional[dict] = None, restoreId: bool = False, *args, **kwargs) → bool¶ Default deserialize method.
It needs to be overridden for each node implementation.
- Parameters
data (dict) – serialized data dictionary
hashmap (dict) –
restoreId (bool) – whether or not the id of the objects are restored
- Return bool
success status
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
class
nodedge.graphics_node_content.
TextEdit
¶ Bases:
PySide2.QtWidgets.QTextEdit
Note
This class is example of
QTextEdit
modification to be able to handle Delete key with overridden Qt’skeyPressEvent
(when not usingQActions
in menu or toolbar)overridden
QTextEdit
which sends notification about being edited to parent’s containerGraphicsNodeContent
-
focusInEvent
(event: PySide2.QtGui.QFocusEvent) → None¶ Example of overridden focusInEvent to mark start of editing.
- Parameters
event (QFocusEvent) – Qt’s focus event
-
focusOutEvent
(event: PySide2.QtGui.QFocusEvent) → None¶ Example of overridden focusOutEvent to mark end of editing
- Parameters
event (QFocusEvent) – Qt’s focus event
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
-
class
nodedge.graphics_node_content.
GraphicsNodeContentProxy
(graphicsNodeParent: GraphicsNode)¶ Bases:
PySide2.QtWidgets.QGraphicsProxyWidget
GraphicsNodeContentProxy
class.It is a
QGraphicsProxyWidget
around theGraphicsNodeContent
.-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-