TextEdit
Similar to LineEdit
, but can be used to enter several lines of text
Properties
font-size
(in length): the size of the font of the input texttext
(in-out string): The text being editedhas-focus
: (in_out bool): Set to true when the widget currently has the focusenabled
: (in bool): Defaults to true. When false, nothing can be enteredread-only
(in bool): When set to true, text editing via keyboard and mouse is disabled but selecting text is still enabled as well as editing text programmatically (default value:false
)
wrap
enum TextWrap default: the first enum value
TextWrap
This enum describes the how the text wrap if it is too wide to fit in the Text
width.
no-wrap
: The text won’t wrap, but instead will overflow.word-wrap
: The text will be wrapped at word boundaries if possible, or at any location for very long words.char-wrap
: The text will be wrapped at any character. Currently only supported by the Qt and Software renderers.
The way the text wraps (default: word-wrap).
horizontal-alignment
enum TextHorizontalAlignment default: the first enum value
TextHorizontalAlignment
This enum describes the different types of alignment of text along the horizontal axis of a Text
element.
left
: The text will be aligned with the left edge of the containing box.center
: The text will be horizontally centered within the containing box.right
: The text will be aligned to the right of the containing box.
The horizontal alignment of the text.
placeholder-text
: (in string): A placeholder text being shown when there is no text in the edit field.
Functions
focus()
Call this function to focus the TextEdit and make it receive future keyboard events.clear-focus()
Call this function to remove keyboard focus from thisTextEdit
if it currently has the focus. See also focus handling.set-selection-offsets(int, int)
Selects the text between two UTF-8 offsets.select-all()
Selects all text.clear-selection()
Clears the selection.copy()
Copies the selected text to the clipboard.cut()
Copies the selected text to the clipboard and removes it from the editable area.paste()
Pastes the text content of the clipboard at the cursor position.
Callbacks
edited(string)
: Emitted when the text has changed because the user modified itrejected()
: Emitted when the user pressed the escape key