PlasmaComponents

Signals | |
void | accepted () |
Public Member Functions | |
void | copy () |
void | cut () |
void | forceActiveFocus () |
void | paste () |
int | positionAt (int pos) |
void | positionToRectangle (int pos) |
void | select (int start, int end) |
void | selectAll () |
void | selectWord () |
Properties | |
alias | acceptableInput |
alias | activeFocus |
bool | clearButtonShown |
int | cursorPosition |
enum | echoMode |
bool | errorHighlight |
font | font |
string | inputMask |
int | inputMethodHints |
int | maximumLength |
alias | passwordCharacter |
string | placeholderText |
bool | readOnly |
string | selectedText |
int | selectionEnd |
int | selectionStart |
string | text |
QtObject | validator |
Detailed Description
Member Function Documentation
|
signal |
Emitted when the text input is accepted.
void TextField::copy | ( | ) |
Copies the currently selected text to the system clipboard.
void TextField::cut | ( | ) |
Moves the currently selected text to the system clipboard.
void TextField::forceActiveFocus | ( | ) |
void TextField::paste | ( | ) |
Replaces the currently selected text by the contents of the system clipboard.
int TextField::positionAt | ( | int | pos | ) |
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.
- Parameters
-
pos x-coordinate we are interested in.
- Returns
- the character position
void TextField::positionToRectangle | ( | int | 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.
- Parameters
-
pos the text position the cursor rectangle
void TextField::select | ( | int | start, |
int | end | ||
) |
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).
- Parameters
-
start Start of selection end End of selection
void TextField::selectAll | ( | ) |
Causes all text to be selected.
void TextField::selectWord | ( | ) |
Causes the word closest to the current cursor position to be selected.
Property Documentation
alias TextField::acceptableInput |
Definition at line 89 of file TextField.qml.
alias TextField::activeFocus |
Definition at line 229 of file TextField.qml.
bool TextField::clearButtonShown |
Whether the button to clear the text from TextField is visible.
Definition at line 167 of file TextField.qml.
int TextField::cursorPosition |
This property holds the current cursor position.
Definition at line 63 of file TextField.qml.
enum TextField::echoMode |
Specifies how the text should be displayed in the TextField.
The acceptable values are:
- TextInput.Normal: Displays the text as it is. (Default)
- TextInput.Password: Displays asterixes instead of characters.
- TextInput.NoEcho: Displays nothing.
- TextInput.PasswordEchoOnEdit: Displays all but the current character as asterixes.
The default value is TextInput.Normal
Definition at line 85 of file TextField.qml.
bool TextField::errorHighlight |
Whether the text field is highlighted or not.
If it is true then the problematic lines will be highlighted.
- Warning
- Not implemented in Plasma components.
Definition at line 35 of file TextField.qml.
font TextField::font |
The font used in the text field.
The default font value is the font from plasma desktop theme.
Definition at line 58 of file TextField.qml.
string TextField::inputMask |
Allows you to set 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 TextInput.
Definition at line 100 of file TextField.qml.
int TextField::inputMethodHints |
The currently supported input method hints for the text field.
The default values is Qt.ImhNone.
Definition at line 51 of file TextField.qml.
int TextField::maximumLength |
The maximum permitted length of the text in the TextField.
If the text is too long, it is truncated at the limit.
Default value is 32767.
Definition at line 158 of file TextField.qml.
alias TextField::passwordCharacter |
Definition at line 87 of file TextField.qml.
string TextField::placeholderText |
The text displayed in when the text is empty.
The default value is an empty string, meaning no placeholderText shown.
Definition at line 44 of file TextField.qml.
bool TextField::readOnly |
This property holds if the text field can be modified by the user interaction.
The default value is false.
Definition at line 70 of file TextField.qml.
string TextField::selectedText |
The text selected by the user.
If no text is selected it holds an empty string.
This property is read-only.
Definition at line 130 of file TextField.qml.
int TextField::selectionEnd |
The cursor position after the last character in the current selection.
This property is read-only.
Definition at line 137 of file TextField.qml.
int TextField::selectionStart |
The cursor position before the first character in the current selection.
This property is read-only.
Definition at line 144 of file TextField.qml.
string TextField::text |
The text in the text field.
Definition at line 149 of file TextField.qml.
QtObject TextField::validator |
Allows you to set a validator on the TextField.
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:
Definition at line 123 of file TextField.qml.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.