Skip to content

QElidingLineEdit

A QLineEdit that elides its text while it isn't being edited: when the text is too long to fit, its end is replaced with an ellipsis ("…"). When the line edit has focus, it shows the full text, for editing. text() always returns the full text.

As with QElidingLabel, setElideMode sets which part of the text is elided.

QElidingLineEdit QElidingLineEdit
from qtpy.QtWidgets import QApplication

from superqt import QElidingLineEdit

app = QApplication([])

line_edit = QElidingLineEdit(
    "/Users/me/Documents/projects/experiments/2026-11-12/results/summary.csv"
)
line_edit.resize(300, 30)
line_edit.show()

app.exec()

QElidingLineEdit

QElidingLineEdit(*args, **kwargs)

A QLineEdit variant that will elide text (could add '…') to fit width.

QElidingLineEdit() QElidingLineEdit(parent: Optional[QWidget]) QElidingLineEdit(text: str, parent: Optional[QWidget] = None)

Subclass of QLineEdit

QElidingLineEdit inherits all of QLineEdit's methods, signals, and properties. Only those that superqt adds or changes are listed here.

Methods

A QLineEdit variant that will elide text (could add '…') to fit width.

QElidingLineEdit() QElidingLineEdit(parent: Optional[QWidget]) QElidingLineEdit(text: str, parent: Optional[QWidget] = None)

elideMode

elideMode() -> TextElideMode

The current Qt.TextElideMode.

full_text

full_text() -> str

The current text without eliding.

setElideMode

setElideMode(mode: TextElideMode) -> None

Set the elide mode to a Qt.TextElideMode.

The text shown is updated to the elided version only if the widget is not focused.

setEllipsesWidth

setEllipsesWidth(width: int) -> None

A width value to take into account ellipses width when eliding text.

The value is deducted from the widget width when computing the elided version of the text. The text shown is updated to the elided version only if the widget is not focused.

setText

setText(text) -> None

Set the line edit's text.

Setting the text clears any previous content. NOTE: we set the QLineEdit private text to the elided version

text

text() -> str

Return the label's text being shown.

If no text has been set this will return an empty string.

wrapText

wrapText(text, width, font=None) -> list[str]

Returns text, split as it would be wrapped for width, given font.

Static method.