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). Use \ to escape the special characters listed above to use them as separators. Terminates the input mask and sets the blank character to c. Hexadecimal character permitted but not required.īinary character permitted but not required.Īll following alphabetic characters are uppercased.Īll following alphabetic characters are lowercased. See also QTextEdit, QLabel, QComboBox, and Line Edits Example.Ĭharacter of the Letter category required, such as A-Z, a-z.Ĭharacter of the Letter category permitted but not required.Ĭharacter of the Letter or Number category required, such as A-Z, a-z, 0-9.Ĭharacter of the Letter or Number category permitted but not required.Īny non-blank character permitted but not required.Ĭharacter of the Number category required, e.g 0-9.Ĭharacter of the Number category permitted but not required.Ĭharacter of the Number category and larger than zero required, such as 1-9Ĭharacter of the Number category and larger than zero permitted but not required, such as 1-9.Ĭharacter of the Number category, or plus/minus sign permitted but not required. ![]() Pastes the clipboard text into line edit.ĭeletes the selected text and copies it to the clipboard.Īny other key sequence that represents a valid character, will cause the character to be inserted into the line edit. Moves the cursor to the beginning of the line.ĭeletes the character to the left of the cursor.ĭeletes the word to the left of the cursor.ĭeletes the character to the right of the cursor.ĭeletes the word to the right of the cursor.Ĭopies the selected text to the clipboard. Moves and selects text one character to the right. Moves the cursor one character to the right. ![]() Moves and selects text one character to the left. Moves the cursor one character to the left. The line edit also provides a context menu (usually invoked by a right mouse click) that presents some of these editing options. The default key bindings are described below. Note that if there is a validator set on the line edit, the returnPressed()/ editingFinished() signals will only be emitted if the validator returns QValidator::Acceptable.īy default, QLineEdits have a frame as specified by platform style guides you can turn it off by calling setFrame(false). Note that if focus is lost without any changes done, the editingFinished() signal won't be emitted. When editing is finished, either because the line edit lost focus or Return/Enter is pressed the editingFinished() signal is emitted. When the text changes the textChanged() signal is emitted when the text changes other than by calling setText() the textEdited() signal is emitted when the cursor is moved the cursorPositionChanged() signal is emitted and when the Return or Enter key is pressed the returnPressed() signal is emitted. The text can be aligned with setAlignment(). Text can be selected with setSelection() or selectAll(), and the selection can be cut(), copy()ied and paste()d. The text is retrieved with text() the displayed text (which may be different, see EchoMode) is retrieved with displayText(). ![]() You can change the text with setText() or insert(). When switching between a validator and an input mask on the same line edit, it is best to clear the validator or input mask to prevent undefined behavior.Ī related class is QTextEdit which allows multi-line, rich text editing. The text can be arbitrarily constrained using a validator() or an inputMask(), or both. The length of the text can be constrained to maxLength(). SetTextMargins(int left, int top, int right, int bottom)Ī line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop (see setDragEnabled()).īy changing the echoMode() of a line edit, it can also be used as a "write-only" field, for inputs such as passwords. SetCursorMoveStyle(Qt::CursorMoveStyle style) QLineEdit(const QString & contents, QWidget * parent = nullptr)ĪddAction(QAction * action, QLineEdit::ActionPosition position)ĪddAction(const QIcon & icon, QLineEdit::ActionPosition position)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |