MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QML TextArea Element

The TextArea item displays multiple lines of editable formatted text More...

This element was introduced in qt-components 4.7.

Properties

Methods

Detailed Description

The TextArea item displays multiple lines of editable formatted text.

 TextArea {
     anchors {left: parent.left; right: parent.right;}
     text: "This is a\nmultiline\ntext area"
     height: Math.max (200, implicitHeight)
 }

Property Documentation

cursorPosition : int

The position of the cursor in the TextArea.


enableSoftwareInputPanel : bool

Allows you to disable the default software input panel. Enabled by default.


font : Font

Font properties for the text.


horizontalAlignment : enumeration

verticalAlignment : enumeration

Sets the horizontal and vertical alignment of the text within the width and height of the TextEdit item. By default, the text is top-left aligned. Valid values for horizontalAlignment are:

  • TextEdit.AlignLeft (default)
  • TextEdit.AlignRight
  • TextEdit.AlignHCenter

Valid values for verticalAlignment are:

  • TextEdit.AlignTop (default)
  • TextEdit.AlignBottom TextEdit.AlignVCenter

inputMethodHints : Qt::InputMethodHints

Sets the current input method hints.


placeholderText : string

Text that appear if there is no focus and no content on the component.


platformSipAttributes : Item

By default all attributes are disabled.

Use this property to set software input panel attributes.

This property should be set to an instance of SipAttributes, which are be used for example to highlight or disable the action key.


platformStyle : Item

Element holding the platform specific styling.


platformWesternNumericInputEnforced : bool

In some rare cases it is required to have a western numeric input panel even when the default input method is set to a language that uses non-western digits (like arabic). This may be the case when the input area expects, for example, credit card numbers.

The default is false.


readOnly : bool

Property default is false.

Sets whether the user can interact with the TextEdit item. If this property is set to true the user cannot edit the text.


selectedText : string

This read-only property provides the text currently selected in the text edit.


selectionEnd : int

The cursor position after the last character in the current selection.


selectionStart : int

The cursor position before the first character in the current selection.


text : string

The text to display. If the text format is AutoText the text edit will automatically determine whether the text should be treated as rich text.


textFormat : enumeration

The way the text property are displayed. TextEdit.AutoText TextEdit.PlainText TextEdit.RichText TextEdit.StyledText


wrapMode : enumeration

The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap.

Set this property to wrap the text to the width of the TextArea item. The text wraps only if an explicit width has been set.

  • TextEdit.NoWrap - no wrapping is performed. If the text contains insufficient newlines, then implicitWidth exceeds a set width.
  • TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth exceeds a set width.
  • TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.
  • TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it occurs at the appropriate point on the line, even in the middle of a word.

Method Documentation

TextArea::closeSoftwareInputPanel ()

Closes a software input panel like a virtual keyboard shown on the screen, useful for customizing when you want the input keyboard to be shown and hidden in your application.


TextArea::copy ()

Copies the selected text into the clipboard.


TextArea::cut ()

Cuts the selected text and copies it on the clipboard.


TextArea::forceActiveFocus ()

Forces active focus on the item. This method sets focus on the item and makes sure that all the focus scopes higher in the object hierarchy are also given focus.


TextArea::openSoftwareInputPanel ()

Opens software input panels like virtual keyboards for typing, useful for customizing when you want the input keyboard to be shown and hidden in your application.


TextArea::paste ()

Pastes the text from the clipboard in the current cursor position.


TextArea::positionAt ( x, y )

Returns the text position closest to pixel position (x, y).

Position 0 is before the first character, position 1 is after the first character but before the second, and so on until position text.length, which is after all characters.


TextArea::positionToRectangle ( pos )

Returns the rectangle at the given position in the text. The x, y, and height properties correspond to the cursor that would describe that position.


TextArea::select ( start, end )

Selects the text between position start and end.


TextArea::selectAll ()

Selecta all the text.


TextArea::selectWord ()

Selects the word nearest to the cursor position