graphics_node_subtitle
graphics_node_subtitle
¶
Classes¶
GraphicsNodeSubtitle(gr_node)
¶
Bases: QGraphicsSimpleTextItem
Extra text under the title of a graphics node. Not editable.
Long text is elided in the middle, so a path keeps both of its ends, and the full text is shown as a tooltip. The item takes no room while it has no text.
Initialize GraphicsNodeSubtitle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gr_node
|
GraphicsNode
|
graphics node the subtitle belongs to. |
required |
Source code in src/nyx/editor/graphics/graphics_node_subtitle.py
27 28 29 30 31 32 33 34 35 36 37 38 39 | |
Attributes¶
COLOR = QtGui.QColor('#9A9A9A')
class-attribute
instance-attribute
¶
HEADER_PADDING = 4.0
class-attribute
instance-attribute
¶
MAX_WIDTH = 200.0
class-attribute
instance-attribute
¶
SUBTITLE_FONT = QtGui.QFont('Zed Mono', 8)
class-attribute
instance-attribute
¶
TITLE_OVERLAP = 2.0
class-attribute
instance-attribute
¶
full_text
property
¶
str: the text as given, before eliding.
gr_node = gr_node
instance-attribute
¶
height
property
¶
float: height the subtitle adds to the header, 0 without text.
width
property
¶
float: width of the shown text, 0 without text.
Functions¶
paint(painter, option, widget=None)
¶
Draw the text unless it is too small to read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
painter
|
QPainter
|
painter. |
required |
option
|
QStyleOptionGraphicsItem
|
style options. |
required |
widget
|
QWidget | None
|
painted widget. |
None
|
Source code in src/nyx/editor/graphics/graphics_node_subtitle.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
refresh(text)
¶
Show a text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
subtitle of the node, empty for none. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
text changed, so the owner needs a new layout. |
Source code in src/nyx/editor/graphics/graphics_node_subtitle.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |