Auto-Elide label

This simple yet commonly used class helps add an elide (a ”...” at the end) to text when it doesn’t fit within a given space.

class elided_label.ElidedLabel(parent=None)[source]

Bases: PySide.QtGui.QLabel

Label that gracefully handles when the text doesn’t fit within the given space.

Parameters:parent (QWidget) – The parent QWidget
elide_mode

Property to get or set the elide mode. The value provided should be either QtCore.Qt.ElideLeft or QtCore.Qt.ElideRight

text()[source]

Overridden base method to return the original unmodified text

Returns:The original unmodified text
setText(text)[source]

Overridden base method to set the text on the label

Parameters:text – The text to set on the label
line_width

(int) width of the line of text in pixels