Icon Label Frames¶
Icon label frames are frames that contain an icon and a text next to it. The icon is laid out vertically centered to the left of the text, and the text is wrapped to fit inside of the available space of the widget.
HTML-style formatting can be used in the text, including <a>
links.
A callback function can be registered to be called when a link in an icon label
frame’s text has been clicked.
Class Inheritance
UI4.Widgets.IconLabelFrame¶
- class UI4.Widgets.IconLabelFrame¶
Bases:
PyQt5.QtWidgets.QFrame
Class implementing a frame that contains two labels for displaying an icon and a text next to it, with support for registering a callback function that is called when a link in the icon label’s text has been clicked.
The icon label and text label are contained in a horizontal box layout in a nested
QtWidgets.QFrame
, which itself is contained in a vertical box layout within the mainQtWidgets.QFrame
.Example Screenshot:
- class NestedIconLabelFrame(iconPixmap, text, parent=None)¶
Bases:
PyQt5.QtWidgets.QFrame
Nested class implementing a frame with a horizontal layout that contains the two labels for displaying an icon and a text next to it.
- __init__(iconPixmap, text, parent=None)¶
Initializes an instance of the class.
- Parameters
iconPixmap (
QtGui.QPixmap
) – The icon image to show in the frame.text (
str
) – The text to show in the frame.parent (
QtWidgets.QWidget
orNone
) – The parent widget to own the new instance. Passed verbatim to theQtWidgets.QFrame
initializer.
- getText()¶
- Return type
str
- Returns
The text shown in the icon label frame.
- on_textLabel_linkActivated(link)¶
Slot that is called when a link in the text of the label has been clicked.
Calls the registered link click callback, if any, with the given link.
- Parameters
link (
str
) – The value of the HREF attribute of the link that was clicked.
- setForegroundRole(foregroundRole)¶
Sets the foreground role to use for the label in the icon label frame.
- Parameters
foregroundRole (
QtGui.QPalette.ColorRole
) – The foreground role to use for the label in the icon label frame.
- setIconPixmap(iconPixmap)¶
Sets icon image to show in the layout.
- Parameters
iconPixmap (
QtGui.QPixmap
) – The icon image to show in the layout.
- setLinkClickCallback(linkClickCallback)¶
Sets the function to call when a link in the label’s text has been clicked.
- Parameters
linkClickCallback (
callable
orNone
) – A callable object that should be called when a link in the label’s text has been clicked, orNone
to clear the registered callback function.
- setText(text)¶
Sets the text to show in the icon label layout.
- Parameters
text (
str
) – The text to show in the icon label layout.
- setWordWrap(wordWrap)¶
Sets whether text in the label inside of the icon label frame should break into multiple lines when necessary.
- Parameters
wordWrap (
bool
) – Flag that controls whether text in the label inside of the icon label frame should break into multiple lines when necessary.
- __init__(iconPixmap, text, margin=0, parent=None, flags=0)¶
Initializes an instance of the class.
- Parameters
iconPixmap (
QtGui.QPixmap
) – The icon image to show in the frame.text (
str
) – The text to show in the frame.margin (
int
) – The margin to use in the main layout of the frame.parent (
QtWidgets.QWidget
orNone
) – The parent widget to own the new instance. Passed verbatim to theQtWidgets.QFrame
initializer.flags (
QtCore.Qt.WindowFlags
) – The window flags to use in case no parent is given. Passed verbatim to theQtWidgets.QFrame
initializer.
- getText()¶
- Return type
str
- Returns
The text shown in the icon label frame.
- setContentsMargins(left, top, right, bottom)¶
Sets the margin to use in the main layout of the frame.
- Parameters
left (
int
) – The left margin to use in the main layout of the frame.top (
int
) – The top margin to use in the main layout of the frame.right (
int
) – The right margin to use in the main layout of the frame.bottom (
int
) – The bottom margin to use in the main layout of the frame.
- setForegroundRole(foregroundRole)¶
Sets the foreground role to use for the label in the icon label frame.
- Parameters
foregroundRole (
QtGui.QPalette.ColorRole
) – The foreground role to use for the label in the icon label frame.
- setIconPixmap(iconPixmap)¶
Sets icon image to show in the icon label frame.
- Parameters
iconPixmap (
QtGui.QPixmap
) – The icon image to show in the icon label frame.
- setLinkClickCallback(linkClickCallback)¶
Sets the function to call when a link in the icon label’s text has been clicked.
- Parameters
linkClickCallback (
callable
orNone
) – A callable object that should be called when a link in the icon label’s text has been clicked, orNone
to clear the registered callback function.
- setMargin(margin)¶
- Deprecated
This function is deprecated. Please use setContentsMargins() instead.
- setText(text)¶
Sets the text to show in the icon label frame.
- Parameters
text (
str
) – The text to show in the icon label frame.
- setWordWrap(wordWrap)¶
Sets whether text in the label inside of the icon label frame should break into multiple lines when necessary.
- Parameters
wordWrap (
bool
) – Flag that controls whether text in the label inside of the icon label frame should break into multiple lines when necessary.
- tabPressed¶
UI4.Widgets.IndicatorLabelFrame¶
- class UI4.Widgets.IndicatorLabelFrame¶
Bases:
UI4.Widgets.IconLabelFrame.IconLabelFrame
Class representing an icon label frame for displaying a message and the names of a number of nodes that can be clicked to jump to the respective node in a B{Node Graph} tab.
Example Screenshot:
- __init__(activeIconName=None, inactiveIconName=None, autoHide=True, parent=None, flags=0)¶
Initializes an instance of the class.
- Parameters
activeIconName (
str
orNone
) – The name of the icon to show when the indicator label frame is in an active state, orNone
to not show an icon or to show a blank icon of the same size as theinactiveIconName
icon.inactiveIconName (
str
orNone
) – The name of the icon to show when the indicator label frame is in an inactive state, orNone
to not show an icon or to show a blank icon of the same size as theactiveIconName
icon.autoHide (
bool
) – Flag that controls whether to automatically hide the widget if no message has been set.parent (
QtWidgets.QWidget
orNone
) – The parent widget to own the new instance. Passed verbatim to the base class initializer.flags (
QtCore.Qt.WindowFlags
) – The window flags to use in case no parent is given. Passed verbatim to the base class initializer.
- setAutoHide(autoHide)¶
Sets the flag that controls whether to automatically hide the widget if it is in an inactive state.
- Parameters
autoHide (
bool
) –True
if the widget is to be automatically hidden when inactive, otherwiseFalse
.
- updateDisplay(active, message='', nodeNames=None)¶
Updates the indicator label frame with the given message and names of nodes, and updates its icon according to the given active state.
- Parameters
active (
bool
) – Flag that controls whether to show the active icon or the inactive icon (or a blank icon) in the frame.message (
str
) – The message to display in the frame’s label before the names of nodes (if any).nodeNames (
list
orstr
orNone
) – A list of names of nodes or a single name of a node to display in the frame’s label after the given message.
UI4.Widgets.AttributeEditorIndicatorLabel¶
- class UI4.Widgets.AttributeEditorIndicatorLabel¶
Bases:
UI4.Widgets.IndicatorLabelFrame.IndicatorLabelFrame
Class representing an indicator label frame for showing the names of nodes that are registered for editing attributes of a currently selected scene graph location.
Example Screenshot:
- __init__(parent=None)¶
Initializes an instance of the class.
- Parameters
parent (
QtWidgets.QWidget
orNone
) – The parent widget to own the new instance. Passed verbatim to the base class initializer.
- setDisplay(editable, message='', nodeName='')¶
Updates the indicator label frame with the given message and names of nodes, and updates its icon according to the given editable state.
- Parameters
editable (
bool
) – Flag that controls whether to show the active icon or the inactive icon (or a blank icon) in the frame.message (
str
) – The message to display in the frame’s label before the names of nodes (if any).nodeName (
str
) – A name of a node or a number of names of nodes, separated by commas, to display in the frame’s label after the given message.
UI4.Widgets.ViewIndicatorLabel¶
- class UI4.Widgets.ViewIndicatorLabel¶
Bases:
UI4.Widgets.IndicatorLabelFrame.IndicatorLabelFrame
Class representing an indicator label frame for showing currently viewed nodes.
Example Screenshot:
- __init__(parent=None)¶
Initializes an instance of the class.
- Parameters
parent (
QtWidgets.QWidget
orNone
) – The parent widget to own the new instance. Passed verbatim to the base class initializer.
- setDisplay(editable, message='', nodeName='')¶
Updates the indicator label frame with the given message and names of nodes, and updates its icon according to the given editable state.
- Parameters
editable (
bool
) – Flag that controls whether to show the active icon or the inactive icon (or a blank icon) in the frame.message (
str
) – The message to display in the frame’s label before the names of nodes (if any).nodeName (
str
) – A name of a node or a number of names of nodes, separated by commas, to display in the frame’s label after the given message.