Struct LineEdit

Control that provides single-line string editing.

struct LineEdit ;

LineEdit provides a single-line string editor, used for text fields. It features many built-in shortcuts which will always be available (Ctrl here maps to Command on macOS): - Ctrl + C: Copy - Ctrl + X: Cut - Ctrl + V or Ctrl + Y: Paste/"yank" - Ctrl + Z: Undo - Ctrl + Shift + Z: Redo - Ctrl + U: Delete text from the cursor position to the beginning of the line - Ctrl + K: Delete text from the cursor position to the end of the line - Ctrl + A: Select all text - Up/Down arrow: Move the cursor to the beginning/end of the line On macOS, some extra keyboard shortcuts are available: - Ctrl + F: Like the right arrow key, move the cursor one character right - Ctrl + B: Like the left arrow key, move the cursor one character left - Ctrl + P: Like the up arrow key, move the cursor to the previous line - Ctrl + N: Like the down arrow key, move the cursor to the next line - Ctrl + D: Like the Delete key, delete the character on the right side of cursor - Ctrl + H: Like the Backspace key, delete the character on the left side of the cursor - Command + Left arrow: Like the Home key, move the cursor to the beginning of the line - Command + Right arrow: Like the End key, move the cursor to the end of the line

Properties

NameTypeDescription
_align[get, set] LineEdit.AlignText alignment as defined in the align enum.
caretBlink[get, set] boolIf true, the caret (visual cursor) blinks.
caretBlinkSpeed[get, set] doubleDuration (in seconds) of a caret's blinking cycle.
caretPosition[get, set] longThe cursor's position inside the LineEdit. When set, the text may scroll to accommodate it.
clearButtonEnabled[get, set] boolIf true, the LineEdit will show a clear button if text is not empty, which can be used to clear the text quickly.
contextMenuEnabled[get, set] boolIf true, the context menu will appear when right-clicked.
editable[get, set] boolIf false, existing text cannot be modified and new text cannot be added.
expandToTextLength[get, set] boolIf true, the LineEdit width will increase to stay longer than the text. It will not compress if the text is shortened.
maxLength[get, set] longMaximum amount of characters that can be entered inside the LineEdit. If 0, there is no limit.
placeholderAlpha[get, set] doubleOpacity of the placeholderText. From 0 to 1.
placeholderText[get, set] StringText shown when the LineEdit is empty. It is not the LineEdit's default value (see text).
rightIcon[get, set] TextureSets the icon that will appear in the right end of the LineEdit if there's no text, or always, if clearButtonEnabled is set to false.
secret[get, set] boolIf true, every character is replaced with the secret character (see secretCharacter).
secretCharacter[get, set] StringThe character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
selectingEnabled[get, set] boolIf false, it's impossible to select the text using mouse nor keyboard.
shortcutKeysEnabled[get, set] boolIf false, using shortcuts will be disabled.
text[get, set] StringString value of the LineEdit. Note: Changing text using this property won't emit the textChanged signal.

Methods

NameDescription
_editorSettingsChanged
_guiInput
_textChanged
_toggleDrawCaret
appendAtCursor Adds text after the cursor. If the resulting value is longer than maxLength, nothing happens.
clear Erases the LineEdit text.
cursorGetBlinkEnabled
cursorGetBlinkSpeed
cursorSetBlinkEnabled
cursorSetBlinkSpeed
deselect Clears the current selection.
getAlign
getCursorPosition
getExpandToTextLength
getMaxLength
getMenu Returns the PopupMenu of this LineEdit. By default, this menu is displayed when right-clicking on the LineEdit.
getPlaceholder
getPlaceholderAlpha
getRightIcon
getSecretCharacter
getText
isClearButtonEnabled
isContextMenuEnabled
isEditable
isSecret
isSelectingEnabled
isShortcutKeysEnabled
menuOption Executes a given action as defined in the menuitems enum.
select Selects characters inside LineEdit between from and to. By default, from is at the beginning and to at the end.
selectAll Selects the whole String.
setAlign
setClearButtonEnabled
setContextMenuEnabled
setCursorPosition
setEditable
setExpandToTextLength
setMaxLength
setPlaceholder
setPlaceholderAlpha
setRightIcon
setSecret
setSecretCharacter
setSelectingEnabled
setShortcutKeysEnabled
setText

Enums

NameDescription
Align
Constants
MenuItems