The TextField element displays a single line of editable plain text. Input constraints can be set through validator or inputMask. Setting echoMode to an appropriate value enables TextField to be used as password input field. More...
This component is under heavy development.
Example:
Item { TextField { placeholderText: "hint text" } TextField { placeholderText: "without clear sign" hasClearButton: false } TextField { placeholderText: "password" echoMode: TextInput.Password } TextField { placeholderText: "overlaid in front" primaryItem: Image { height: parent.height width: height source: "magnifier.png" } secondaryItem: Row { Button { ItemStyle.class: "transparent-button" height: parent.height width: height iconSource: "caps-lock.png" onClicked: doSomething() } Button { ItemStyle.class: "transparent-button" height: parent.height width: height iconSource: "num-lock.png" onClicked: doSomething() } } } }
This documentation is under development and is subject to change.
This property is always true unless a validator or input mask has been set. If a validator or input mask has been set, this property will only be true if the current text is acceptable to the validator or input mask as a final string (not as an intermediate string).
This documentation is under development and is subject to change.
The position of the cursor in the TextField.
This documentation is under development and is subject to change.
Component to be shown and used instead of the default On Screen Keyboard.
This documentation is under development and is subject to change.
Specifies how the text should be displayed in the TextField.
- TextInput.Normal - Displays the text as it is. (Default) - TextInput.Password - Displays asterixes instead of characters. - TextInput.NoEcho - Displays nothing. - TextInput.PasswordEchoOnEdit - Displays characters as they are entered while editing, otherwise displays asterisks.
This documentation is under development and is subject to change.
Allows highlighting errors in the TextField.
This documentation is under development and is subject to change.
Font used in the TextField.
This documentation is under development and is subject to change.
Specifies whether the control has a clear button or not.
This documentation is under development and is subject to change.
This property holds whether the TextInput has partial text input from an input method.
While it is composing an input method may rely on mouse or key events from the TextField to edit or commit the partial text. This property can be used to determine when to disable events handlers that may interfere with the correct operation of an input method.
This documentation is under development and is subject to change.
The maximum permitted length of the text in the TextField.
If the text is too long, it is truncated at the limit.
By default, this property contains a value of 32767.
This documentation is under development and is subject to change.
Text that appears when there is no focus and no content in the component.
This documentation is under development and is subject to change.
Overlaid component that can be set for the fore side of the TextField, e.g.showing a magnifier to implement search functionality.
This documentation is under development and is subject to change.
Sets whether user input can modify the contents of the TextField.
If readOnly is set to true, then user input will not affect the text property. Any bindings or attempts to set the text property will still work.
This documentation is under development and is subject to change.
Overlaid component that can be set for the rear side of the TextField, e.g.showing a CAPS LOCK or NUM LOCK indication. The overlaid components will be placed right after the clear button.
This documentation is under development and is subject to change.
This read-only property provides the text currently selected in the text input.
This documentation is under development and is subject to change.
The cursor position after the last character in the current selection.
This property is read-only. To change the selection, use select(start,end), selectAll(), or selectWord().
This documentation is under development and is subject to change.
The cursor position before the first character in the current selection.
This property is read-only. To change the selection, use select(start,end), selectAll(), or selectWord().
This documentation is under development and is subject to change.
The text in the TextField.
This documentation is under development and is subject to change.
Allows you to set a validator on the TextInput. When a validator is set the TextField will only accept input which leaves the text property in an acceptable or intermediate state. The accepted signal will only be sent if the text is in an acceptable state when enter is pressed.
Currently supported validators are IntValidator, DoubleValidator and RegExpValidator. An example of using validators is shown below, which allows input of integers between 11 and 31 into the text input:
import QtQuick 2.0 TextInput{ validator: IntValidator{bottom: 11; top: 31;} focus: true }
This documentation is under development and is subject to change.
This handler is called when the Return or Enter key is pressed. Note that if there is a validator or inputMask set on the text input, the handler will only be emitted if the input is in an acceptable state.
This documentation is under development and is subject to change.
Copies the currently selected text to the system clipboard.
This documentation is under development and is subject to change.
Moves the currently selected text to the system clipboard.
This documentation is under development and is subject to change.
Removes active text selection.
This documentation is under development and is subject to change.
Places the clipboard or the data given as parameter into the text input. The selected text will be replaces with the data.
This documentation is under development and is subject to change.
This function returns the character position at x pixels from the left of the TextField. 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.
This means that for all x values before the first character this function returns 0, and for all x values after the last character this function returns text.length.
The cursor position type specifies how the cursor position should be resolved.
- TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x. - TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.
This documentation is under development and is subject to change.
This function takes a character position and returns the rectangle that the cursor would occupy, if it was placed at that character position.
This is similar to setting the cursorPosition, and then querying the cursor rectangle, but the cursorPosition is not changed.
This documentation is under development and is subject to change.
Causes the text from start to end to be selected.
If either start or end is out of range, the selection is not changed.
After calling this, selectionStart will become the lesser and selectionEnd will become the greater (regardless of the order passed to this method).
This documentation is under development and is subject to change.
Causes all text to be selected.
This documentation is under development and is subject to change.
Causes the word closest to the current cursor position to be selected.