The TextField element displays a single line of editable plain text More...
This element was introduced in qt-components 4.7.
TextField is used to accept a line of text input. Input constraints can be placed on a TextField item (for example, through a validator or inputMask), and setting echoMode to an appropriate value enables TextInput to be used for a password input field.
TextField { placeholderText: "Default text" maximumLength: 80 } TextField { text: "read only text field" readOnly: true }
acceptableInput : bool |
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).
cursorPosition : int |
The position of the cursor in the TextField.
customSoftwareInputPanel : Component |
Replaces the default software input panel with your own.
echoMode : enumeration |
Specifies how the text should be displayed in the TextField.
enableSoftwareInputPanel : bool |
Disables the default software input panel. Enabled by default.
errorHighlight : bool |
Allows you to show error highlight for the TextField.
Usage for mandatory field:
TextField { //... errorHighlight: !acceptableInput validator: IntValidator{bottom: 1000; top: 2000;} }
Usage for optional field:
TextField { errorHighlight: text ? !acceptableInput : false //... }
inputMask : string |
Sets an input mask on the TextField, restricting the allowable text inputs. See QLineEdit::inputMask for further details, as the exact same mask strings are used by TextField.
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.
Sets the software input panel attributes.
This property should be set to an instance of SipAttributes, which can be used to e.g. 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 field expects, for example, credit card numbers.
The default is false.
readOnly : bool |
Property default is false.
Whether the user can interact with the TextField 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. Does not contain the pre-edit text.
validator : QValidator |
Sets a validator on the TextField. When a validator is set the TextField only accepts input which leaves the text property in an acceptable or intermediate state. The accepted signal is only sent if the text is in an acceptable state when enter is pressed. Currently supported validators are IntValidator, DoubleValidator and RegExpValidator.
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.
Forces active focus on the item. This method sets the focus on the item and makes sure that all the focus scopes higher in the object hierarchy are also given focus.
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.
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.
Returns the rectangle at the given position pos in the text. The x, y, and height properties correspond to the cursor that would describe that position.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.