labels
_labels
¶
Custom label widgets.
Classes:
| Name | Description |
|---|---|
FXElidedLabel |
A QLabel that elides text with '...' when it doesn't fit. |
Classes¶
FXElidedLabel
¶
FXElidedLabel(
text: str = "",
parent: Optional[QWidget] = None,
mode: TextElideMode = ElideRight,
)
Bases: QLabel
flowchart TD
fxgui.fxwidgets._labels.FXElidedLabel[FXElidedLabel]
click fxgui.fxwidgets._labels.FXElidedLabel href "" "fxgui.fxwidgets._labels.FXElidedLabel"
A QLabel that elides text with '...' when it doesn't fit.
This label automatically truncates text and adds an ellipsis when the text is too long to fit within the available space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The label's text. Defaults to |
''
|
|
Optional[QWidget]
|
Parent widget. Defaults to |
None
|
|
TextElideMode
|
Where the text is cut when it does not fit. Defaults to
Governs the SINGLE-LINE case only. With |
ElideRight
|
Examples:
>>> from qtpy.QtCore import Qt
>>> from fxgui import fxwidgets
>>> label = fxwidgets.FXElidedLabel(
... "a very long identity", mode=Qt.ElideMiddle
... )
Methods:
| Name | Description |
|---|---|
minimumSizeHint |
No width at all, and the height one line of this font needs. |
resizeEvent |
Re-elide text when the label is resized. |
setText |
Set the text and store the full text for elision. |
setWordWrap |
Wrap the text, and say so if that makes |
Attributes:
| Name | Type | Description |
|---|---|---|
mode |
TextElideMode
|
Where the text is cut when it does not fit. |
Attributes¶
Methods:¶
minimumSizeHint
¶
No width at all, and the height one line of this font needs.
QLabel's own minimum width IS the width of its whole text --
measured, 696px for a 58-character string -- and a minimum is
not a preference: a label that will not go below its own text
width does not elide when the room runs out, it takes the room
from whatever shares its row and, failing that, from the window.
Measured: a 47-character string in a row with a button, in a
window told to be 200px wide, forced the window to 680px and
pushed the button from x=90 to x=570.
Which makes an eliding label with QLabel's minimum a widget
that cannot do the one thing it exists for. This yields the
width instead, which is what eliding means, and keeps the height
so a row is still a row.
Returns:
| Name | Type | Description |
|---|---|---|
QSize |
QSize
|
Zero width, at |