A component for displaying/editing a single line of text.
More...
Signals |
|
void | accepted () |
| | Emitted when the return key is pressed.
|
Public Member Functions |
|
void | clear () |
| | Clears all text.
|
|
void | copy () |
| | Copies the selected text to the clipboard.
|
|
void | cut () |
| | Cuts the selected text to the clipboard.
|
|
void | forceActiveFocus () |
| | Forces the text field to become the current focus item.
|
|
void | paste () |
| | Pastes text from the clipboard into the text area.
|
| point | positionAt (int x) |
| | Returns the cursor position at x.
|
| rect | positionToRectangle (point pos) |
| | Returns the position at point pos as a rectangle.
|
| void | select (int start, int end) |
| | Selects the text between start and end.
|
|
void | selectAll () |
| | Selects all text.
|
|
void | selectWord () |
| | Selects the current word.
|
Properties |
| bool | acceptableInput |
| | Whether the current text passes validation by the validator.
|
|
int | cursorPosition |
| | The current cursor position.
|
| enumeration | echoMode |
| | Specifies how the text should be displayed.
|
|
font | font |
| | The text font.
|
|
enumeration | inputMask |
| | The input mask.
|
|
enumeration | inputMethodHints |
| | The input method hints.
|
|
int | maximumLength |
| | The maximum allowed length of the text.
|
|
string | placeholderText |
| | The text to be displayed when no text is set.
|
| bool | readOnly |
| | Whether the text field is read only.
|
|
string | selectedText |
| | The currently selected text.
|
|
int | selectionEnd |
| | The cursor position at the end of the currently selected text.
|
|
int | selectionStart |
| | The cursor position at the start of the currently selected text.
|
|
TextFieldStyle | style |
| | Provides styling properties for the text field.
|
|
string | text |
| | The current text.
|
| variant | validator |
| | The validator used to validate the text.
|
Detailed Description
A component for displaying/editing a single line of text.
import QtQuick 1.0
import org.hildon.components 1.0
Window {
id: window
title: qsTr("TextField Example")
visible: true
Column {
id: column
anchors.centerIn: parent
width: 300
width: parent.width
text: qsTr(
"Hildon TextField")
}
width: parent.width
text: qsTr(
"Osso TextField")
}
}
}
- See Also
- Label, TextArea, TextFieldStyle
- Examples:
- directory.qml, file.qml, gconf.qml, process.qml, settings.qml, textfield.qml, webview.qml, and widget.qml.
Member Function Documentation
| point TextField::positionAt |
( |
int |
x | ) |
|
Returns the cursor position at x.
- Parameters
-
- Returns
| rect TextField::positionToRectangle |
( |
point |
pos | ) |
|
Returns the position at point pos as a rectangle.
- Parameters
-
- Returns
| void TextField::select |
( |
int |
start, |
|
|
int |
end |
|
) |
| |
Selects the text between start and end.
- Parameters
-
Property Documentation
| bool TextField::acceptableInput |
Whether the current text passes validation by the validator.
Return tru if no validator is set.
- See Also
- validator
| enumeration TextField::echoMode |
Specifies how the text should be displayed.
Possible values are:
| Value | Description |
| 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. |
Whether the text field is read only.
The default value is false.
| variant TextField::validator |