Provides a component for editing and displaying both plain and rich text. More...
This element was introduced in Qt Quick Components 1.0.
The TextArea component displays a block of editable and formatted text. It can display both plain and rich text. TextArea implements the horizontal and vertical scrolling. Scroll bars appear when the content is flicked, or on the focus gain if the content does not fit to view port. TextArea is a superset of TextEdit to implement the Symbian-style look-and-feel. The clipboard support is provided by the cut(), copy(), and paste() functions.
The code examples below illustrate various features of TextArea.
| Code | Appearance |
|---|---|
TextArea { height: 70; width: 160 } |
|
TextArea { height: 70; width: 160 placeholderText: "Enter Text Here" } |
|
TextArea { height: 70; width: 160 text: "TextArea" } |
|
TextArea { height: 70; width: 160 text: "TextArea" focus: true } |
|
TextArea { height: 70; width: 160 text: "Text Area Text Area Text Area Text Area Text Area Text Area." } |
Appearance while draging. See the Touch Interaction section. |
TextArea { height: 70; width: 160 text: "TextArea" readOnly: true } |
|
TextArea { height: 70; width: 160 text: "TextArea" enabled: false } |
|
TextArea { height: 70; width: 160 text: "TextArea" errorHighlight: true } |
|
The examples below illustrate various TextArea selection features in Symbian.
| Selected Text | Adjust Selection |
|---|---|
|
|
| Place Cursor | Paste Menu |
|---|---|
|
|
The text area resizes implicitly to accommodate more text. The maximum sizes are set with the platformMaxImplicitHeight and platformMaxImplicitWidth properties.
| Description | Minimum Size |
|---|---|
| The minimum implicit size for a TextArea is 20 * " " on the current font. |
|
| If there is a placeholderText defined, its length is the text's minimum implicit size. |
|
| Description | Growth pattern |
|---|---|
With the default values a TextArea grows indefinitely to the right.TextArea { text: "TextArea TextArea TextArea TextArea" } |
|
The platformMaxImplicitWidth setting defines a TextArea's wrapping point. When that width is reached the TextArea grows indefinitely downwards.TextArea { platformMaxImplicitWidth: 200 text: "TextArea TextArea TextArea TextArea TextArea TextArea TextArea" } |
|
The platformMaxImplicitHeight and platformMaxImplicitWidth settings restrict a TextArea to grow only to those values.TextArea { platformMaxImplicitHeight: 70 platformMaxImplicitWidth: 200 text: "TextArea TextArea TextArea TextArea TextArea TextArea TextArea" } |
|
See also Entering Text with Split-view Input.
The position of the cursor in a TextArea.
See also TextEdit::cursorPosition.
If the value is true, the TextArea's graphics show that it contains invalid input; otherwise not.
Sets the horizontal and vertical alignment of the text within the TextArea item's width and height. By default, the text is top-left aligned.
For details of the options, see: TextEdit::horizontalAlignment
Settings that indicate what kind of input can be accepted by the TextArea. The value is from Qt::InputMethodHints.
See also Qt::InputMethodHints.
Symbian:
If platformInverted is true, the component is visualized with the inverted style. For more information, see Using Inverted Style with Symbian Components. By default platformInverted is false.
This property group was introduced in Qt Quick Components 1.1.
Defines the maximum height that the TextArea can grow to. If the height is explicitly set, this property has no effect.
The default value for this property is -1 meaning that the height is allowed to grow infinitely.
See also platformMaxImplicitWidth.
Defines the maximum width that the TextArea can grow to. If the width is explicitly set, this property has no effect.
The default value for this property is -1 meaning that the width is allowed to grow infinitely.
See also platformMaxImplicitHeight.
If the value is true, the user can interact (select, copy, and scroll) with but not edit the TextArea's text. If the value is false, the user can also edit the text.
See also TextEdit::readOnly and enabled.
The currently selected text in the text field.
See also TextEdit::selectedText.
The cursor position after the last character in the current selection.
See also selectionStart, selectedText, cursorPosition, and TextEdit::selectionEnd.
The cursor position before the first character in the current selection.
See also selectionEnd, selectedText, cursorPosition, and TextEdit::selectionStart.
Defines whether the text is displayed as rich text or plain text. By default the format of the text is automatically determined.
See TextEdit::textFormat for the enumeration details.
Defines whether the text in the TextArea is wrapped or not.
See TextEdit::wrapMode for details of the different wrapping modes.
Closes the virtual keyboard shown on the screen. On Symbian-based devices the user can open the virtual keyboard by tapping the TextArea.
Note: Currently closeSoftwareInputPanel does not work on Symbian. For more information, see QTBUG-20033.
See also openSoftwareInputPanel and TextEdit::closeSoftwareInputPanel().
Copies the currently selected text to the system clipboard.
See also paste, cut, and TextEdit::copy().
Moves the currently selected text to the system clipboard.
See also TextEdit::cut().
Opens the virtual keyboard for typing. On Symbian-based devices the user can open the virtual keyboard by tapping the TextArea.
See also closeSoftwareInputPanel and TextEdit::openSoftwareInputPanel().
Replaces the currently selected text by the contents of the system clipboard.
See also copy, cut, and TextEdit::paste().
Returns the character position at x pixels from the left edge of the text field and y pixels from the top edge of the text field.
See also TextEdit::positionAt().
Returns the rectangle that the cursor would occupy if it was placed at pos character position.
This is similar to setting the cursorPosition and then querying the cursor rectangle, but the cursorPosition is not changed.
See also cursorPosition and TextEdit::positionToRectangle().
Selects the text from start to end.
See also selectionStart, selectionEnd, and TextEdit::select().
Selects all the text in the text field.
See also TextEdit::selectAll().
Selects the word closest to the current cursor position.
See also TextEdit::selectWord().