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.
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
¶
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)
setElideMode
¶
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
¶
Set the line edit's text.
Setting the text clears any previous content. NOTE: we set the QLineEdit private text to the elided version