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

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


Overridden base method to return the original unmodified text

Returns:The original unmodified text

Overridden base method to set the text on the label

Parameters:text – The text to set on the label

(int) width of the line of text in pixels