Skip to content

PythonQt.QtGui.QLineEdit · declarations 002

Back to PythonQt.QtGui.QLineEdit

end

end(mark: bool) -> None

X.end(mark)

Supplemental documentation: Qt 5 reference:

void QLineEdit::end(bool mark)

Moves the text cursor to the end of the line unless it is already there. If mark is true, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved.

See also home().

Upstream PySide2 reference signatures (binding differences may apply):

end(self, mark: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#end

event

event(arg__1: Any) -> bool

X.event(arg__1) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QLineEdit::event(QEvent *e)

Reimplements: QWidget::event(QEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

event(self, arg__1: PySide2.QtCore.QEvent) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#event

focusInEvent

focusInEvent(arg__1: Any) -> None

X.focusInEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::focusInEvent(QFocusEvent *e)

Reimplements: QWidget::focusInEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusInEvent(self, arg__1: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#focusInEvent

focusOutEvent

focusOutEvent(arg__1: Any) -> None

X.focusOutEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::focusOutEvent(QFocusEvent *e)

Reimplements: QWidget::focusOutEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusOutEvent(self, arg__1: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#focusOutEvent

frame instance-attribute

frame: Any

Qt 5 reference:

frame : bool

This property holds whether the line edit draws itself with a frame.

If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame.

Access functions:

bool hasFrame() const
void setFrame(bool)

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#frame

getTextMargins

getTextMargins(left: Any, top: Any, right: Any, bottom: Any) -> Any

X.getTextMargins(left, top, right, bottom)

Upstream PySide2 reference signatures (binding differences may apply):

getTextMargins(self) -> typing.Tuple[int, int, int, int]

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#getTextMargins

hasAcceptableInput

hasAcceptableInput() -> bool

X.hasAcceptableInput() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

hasAcceptableInput(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#hasAcceptableInput

hasFrame

hasFrame() -> bool

X.hasFrame() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

hasFrame(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#hasFrame

hasSelectedText instance-attribute

hasSelectedText: bool

Qt 5 reference:

hasSelectedText : const bool

This property holds whether there is any text selected.

hasSelectedText() returns true if some or all of the text has been selected by the user; otherwise returns false.

By default, this property is false.

Access functions:

bool hasSelectedText() const

See also selectedText().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#hasSelectedText

home

home(mark: bool) -> None

X.home(mark)

Supplemental documentation: Qt 5 reference:

void QLineEdit::home(bool mark)

Moves the text cursor to the beginning of the line unless it is already there. If mark is true, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved.

See also end().

Upstream PySide2 reference signatures (binding differences may apply):

home(self, mark: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#home

initStyleOption

initStyleOption(option: Any) -> None

X.initStyleOption(option)

Supplemental documentation: Qt 5 reference:

[protected] void QLineEdit::initStyleOption(QStyleOptionFrame *option) const

Initialize option with the values from this QLineEdit. This method is useful for subclasses when they need a QStyleOptionFrame, but don't want to fill in all the information themselves.

See also QStyleOption::initFrom().

Upstream PySide2 reference signatures (binding differences may apply):

initStyleOption(self, option: PySide2.QtWidgets.QStyleOptionFrame) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#initStyleOption

inputMask instance-attribute

inputMask: str

Qt 5 reference:

inputMask : QString

This property holds the validation input mask.

If no mask is set, inputMask() returns an empty string.

Sets the QLineEdit's validation mask. Validators can be used instead of, or in conjunction with masks; see setValidator().

Unset the mask and return to normal QLineEdit operation by passing an empty string ("").

The input mask is an input template string. It can contain the following elements:

Mask Characters Defines the Category of input characters that are considered valid in this position
Meta Characters Various special meanings
Separators All other characters are regarded as immutable separators

The following table shows the mask and meta characters that can be used in an input mask.

Mask Character Meaning
A character of the Letter category required, such as A-Z, a-z.
a character of the Letter category permitted but not required.
N character of the Letter or Number category required, such as A-Z, a-z, 0-9.
n character of the Letter or Number category permitted but not required.
X Any non-blank character required.
x Any non-blank character permitted but not required.
9 character of the Number category required, e.g 0-9.
0 character of the Number category permitted but not required.
D character of the Number category and larger than zero required, such as 1-9
d character of the Number category and larger than zero permitted but not required, such as 1-9.
# character of the Number category, or plus/minus sign permitted but not required.
H Hexadecimal character required. A-F, a-f, 0-9.
h Hexadecimal character permitted but not required.
B Binary character required. 0-1.
b Binary character permitted but not required.
Meta Character Meaning
--- ---
> All following alphabetic characters are uppercased.
< All following alphabetic characters are lowercased.
! Switch off case conversion.
;c Terminates the input mask and sets the blank character to c.
[ ] { } Reserved.
\ Use \ to escape the special characters listed above to use them as separators.

When created or cleared, the line edit will be filled with a copy of the input mask string where the meta characters have been removed, and the mask characters have been replaced with the blank character (by default, a space).

When an input mask is set, the text() method returns a modified copy of the line edit content where all the blank characters have been removed. The unmodified content can be read using displayText().

The hasAcceptableInput() method returns false if the current content of the line edit does not fulfil the requirements of the input mask.

Examples:

Mask Notes
000.000.000.000;_ IP address; blanks are _.
HH:HH:HH:HH:HH:HH;_ MAC address
0000-00-00 ISO Date; blanks are space
>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;# License number; blanks are # and all (alphabetic) characters are converted to uppercase.

To get range control (e.g., for an IP address) use masks together with validators.

Access functions:

QString inputMask() const
void setInputMask(const QString \&inputMask)

See also maxLength, QChar::isLetter(), QChar::isNumber(), and QChar::digitValue().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#inputMask

inputMethodEvent

inputMethodEvent(arg__1: Any) -> None

X.inputMethodEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::inputMethodEvent(QInputMethodEvent *e)

Reimplements: QWidget::inputMethodEvent(QInputMethodEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodEvent(self, arg__1: PySide2.QtGui.QInputMethodEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#inputMethodEvent

inputMethodQuery

inputMethodQuery(arg__1: Any) -> Any

X.inputMethodQuery(arg__1) -> object

Supplemental documentation: Qt 5 reference:

[override virtual] QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const

Reimplements: QWidget::inputMethodQuery(Qt::InputMethodQuery query) const.

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodQuery(self, arg__1: PySide2.QtCore.Qt.InputMethodQuery) -> typing.Any
inputMethodQuery(self, property: PySide2.QtCore.Qt.InputMethodQuery, argument: typing.Any) -> typing.Any

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#inputMethodQuery

inputRejected

inputRejected(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLineEdit.inputRejected; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QLineEdit::inputRejected()

This signal is emitted when the user presses a key that is not considered to be acceptable input. For example, if a key press results in a validator's validate() call to return Invalid. Another case is when trying to enter in more characters beyond the maximum length of the line edit.

Note: This signal will still be emitted in a case where part of the text is accepted but not all of it is. For example, if there is a maximum length set and the clipboard text is longer than the maximum length when it is pasted.

This function was introduced in Qt 5.12.

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#inputRejected

insert

insert(arg__1: str) -> None

X.insert(arg__1)

Supplemental documentation: Qt 5 reference:

void QLineEdit::insert(const QString \&newText)

Deletes any selected text, inserts newText, and validates the result. If it is valid, it sets it as the new contents of the line edit.

See also setText() and clear().

Upstream PySide2 reference signatures (binding differences may apply):

insert(self, arg__1: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#insert

isClearButtonEnabled

isClearButtonEnabled() -> bool

X.isClearButtonEnabled() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isClearButtonEnabled(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#isClearButtonEnabled

isModified

isModified() -> bool

X.isModified() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isModified(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#isModified

isReadOnly

isReadOnly() -> bool

X.isReadOnly() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isReadOnly(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#isReadOnly

isRedoAvailable

isRedoAvailable() -> bool

X.isRedoAvailable() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isRedoAvailable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#isRedoAvailable

isUndoAvailable

isUndoAvailable() -> bool

X.isUndoAvailable() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isUndoAvailable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#isUndoAvailable

keyPressEvent

keyPressEvent(arg__1: Any) -> None

X.keyPressEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::keyPressEvent(QKeyEvent *event)

Reimplements: QWidget::keyPressEvent(QKeyEvent *event).

Converts the given key press event into a line edit action.

If Return or Enter is pressed and the current text is valid (or can be made valid by the validator), the signal returnPressed() is emitted.

The default key bindings are listed in the class's detailed description.

Upstream PySide2 reference signatures (binding differences may apply):

keyPressEvent(self, arg__1: PySide2.QtGui.QKeyEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#keyPressEvent

maxLength instance-attribute

maxLength: int

Qt 5 reference:

maxLength : int

This property holds the maximum permitted length of the text.

If the text is too long, it is truncated at the limit.

If truncation occurs any selected text will be unselected, the cursor position is set to 0 and the first part of the string is shown.

If the line edit has an input mask, the mask defines the maximum string length.

By default, this property contains a value of 32767.

Access functions:

int maxLength() const
void setMaxLength(int)

See also inputMask.

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#maxLength

minimumSizeHint instance-attribute

minimumSizeHint: QSize

Qt 5 reference:

[override virtual] QSize QLineEdit::minimumSizeHint() const

Reimplements an access function for property: QWidget::minimumSizeHint.

Returns a minimum size for the line edit.

The width returned is usually enough for at least one character.

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#minimumSizeHint

modified instance-attribute

modified: Any

Qt 5 reference:

modified : bool

This property holds whether the line edit's contents has been modified by the user.

The modified flag is never read by QLineEdit; it has a default value of false and is changed to true whenever the user changes the line edit's contents.

This is useful for things that need to provide a default value but do not start out knowing what the default should be (perhaps it depends on other fields on the form). Start the line edit without the best default, and when the default is known, if modified() returns false (the user hasn't entered any text), insert the default value.

Calling setText() resets the modified flag to false.

Access functions:

bool isModified() const
void setModified(bool)

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#modified

mouseDoubleClickEvent

mouseDoubleClickEvent(arg__1: Any) -> None

X.mouseDoubleClickEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::mouseDoubleClickEvent(QMouseEvent *e)

Reimplements: QWidget::mouseDoubleClickEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mouseDoubleClickEvent(self, arg__1: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#mouseDoubleClickEvent

mouseMoveEvent

mouseMoveEvent(arg__1: Any) -> None

X.mouseMoveEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::mouseMoveEvent(QMouseEvent *e)

Reimplements: QWidget::mouseMoveEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mouseMoveEvent(self, arg__1: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#mouseMoveEvent

mousePressEvent

mousePressEvent(arg__1: Any) -> None

X.mousePressEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::mousePressEvent(QMouseEvent *e)

Reimplements: QWidget::mousePressEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mousePressEvent(self, arg__1: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#mousePressEvent

mouseReleaseEvent

mouseReleaseEvent(arg__1: Any) -> None

X.mouseReleaseEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::mouseReleaseEvent(QMouseEvent *e)

Reimplements: QWidget::mouseReleaseEvent(QMouseEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

mouseReleaseEvent(self, arg__1: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#mouseReleaseEvent

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLineEdit.objectNameChanged; argument details are not documented.

paintEvent

paintEvent(arg__1: Any) -> None

X.paintEvent(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLineEdit::paintEvent(QPaintEvent *)

Reimplements: QWidget::paintEvent(QPaintEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

paintEvent(self, arg__1: PySide2.QtGui.QPaintEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#paintEvent

paste

paste() -> None

X.paste()

Supplemental documentation: Qt 5 reference:

[slot] void QLineEdit::paste()

Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only.

If the end result would be invalid to the current validator, nothing happens.

See also copy() and cut().

Upstream PySide2 reference signatures (binding differences may apply):

paste(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#paste

placeholderText instance-attribute

placeholderText: str

Qt 5 reference:

placeholderText : QString

This property holds the line edit's placeholder text.

Setting this property makes the line edit display a grayed-out placeholder text as long as the line edit is empty.

Normally, an empty line edit shows the placeholder text even when it has focus. However, if the content is horizontally centered, the placeholder text is not displayed under the cursor when the line edit has focus.

By default, this property contains an empty string.

This property was introduced in Qt 4.7.

Access functions:

QString placeholderText() const
void setPlaceholderText(const QString \&)

See also text().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#placeholderText

readOnly instance-attribute

readOnly: Any

Qt 5 reference:

readOnly : bool

This property holds whether the line edit is read only.

In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text (if echoMode() is Normal), but cannot edit it.

QLineEdit does not show a cursor in read-only mode.

By default, this property is false.

Access functions:

bool isReadOnly() const
void setReadOnly(bool)

See also setEnabled().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#readOnly

redo

redo() -> None

X.redo()

Supplemental documentation: Qt 5 reference:

[slot] void QLineEdit::redo()

Redoes the last operation if redo is available.

Upstream PySide2 reference signatures (binding differences may apply):

redo(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#redo

redoAvailable instance-attribute

redoAvailable: Any

Qt 5 reference:

redoAvailable : const bool

This property holds whether redo is available.

Redo becomes available once the user has performed one or more undo operations on text in the line edit.

By default, this property is false.

Access functions:

bool isRedoAvailable() const

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#redoAvailable

returnPressed

returnPressed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLineEdit.returnPressed; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QLineEdit::returnPressed()

This signal is emitted when the Return or Enter key is pressed. Note that if there is a validator() or inputMask() set on the line edit, the returnPressed() signal will only be emitted if the input follows the inputMask() and the validator() returns QValidator::Acceptable.

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#returnPressed

selectAll

selectAll() -> None

X.selectAll()

Supplemental documentation: Qt 5 reference:

[slot] void QLineEdit::selectAll()

Selects all the text (i.e. highlights it) and moves the cursor to the end. This is useful when a default value has been inserted because if the user types before clicking on the widget, the selected text will be deleted.

See also setSelection() and deselect().

Upstream PySide2 reference signatures (binding differences may apply):

selectAll(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#selectAll

selectedText instance-attribute

selectedText: str

Qt 5 reference:

selectedText : const QString

This property holds the selected text.

If there is no selected text this property's value is an empty string.

By default, this property contains an empty string.

Access functions:

QString selectedText() const

See also hasSelectedText().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#selectedText

selectionChanged

selectionChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLineEdit.selectionChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QLineEdit::selectionChanged()

This signal is emitted whenever the selection changes.

See also hasSelectedText() and selectedText().

Source: https://doc.qt.io/archives/qt-5.15/qlineedit.html#selectionChanged