C
TextInput QML Type
Displays an editable text paragraph. More...
Import Statement: | import QtQuick |
Since: | Qt Quick Ultralite 2.8 |
Properties
- activeFocusOnPress : bool
- color : color
- font : font
- inputMethodHints : enumeration
- text : string
Signals
- accepted()
- textEdited()
Methods
- clear()
Detailed Description
The TextInput type displays a single paragraph of editable plain text. Use it to accept a single paragraph as input.
Note: Languages based on Complex Unicode scripts are not supported currently.
See also Text and Qul::PlatformInterface::handleKeyEvent.
Property Documentation
activeFocusOnPress : bool |
This property indicates whether a TextInput item should get focus on a touch event. It is set to true
by default.
color : color |
This property holds the color of the text.
font : font |
This property holds the font used for displaying the text.
inputMethodHints : enumeration |
Provides hints to the input method about the expected content of the text input and how it should operate.
The value is a bit-wise combination of flags, or Qt.ImhNone if no hints are set. The following flags alter the behavior of a TextInput:
Constant | Description |
---|---|
Qt.ImhHiddenText | Characters should be hidden, as is typically used when entering passwords. |
Qt.ImhSensitiveData | Typed text should not be stored by the active input method in any persistent storage like predictive user dictionary. |
Qt.ImhNoAutoUppercase | The input method should not try to automatically switch to upper case when a sentence ends. |
Qt.ImhPreferNumbers | Numbers are preferred (but not required). |
Qt.ImhPreferUppercase | Upper case letters are preferred (but not required). |
Qt.ImhPreferLowercase | Lower case letters are preferred (but not required). |
Qt.ImhNoPredictiveText | Do not use predictive text (i.e. dictionary lookup) while typing. |
Qt.ImhDate | The text editor functions as a date field. |
Qt.ImhTime | The text editor functions as a time field. |
Flags that restrict input (exclusive flags) are:
Constant | Description |
---|---|
Qt.ImhDigitsOnly | Only digits are allowed. |
Qt.ImhFormattedNumbersOnly | Only number input is allowed. This includes decimal point and minus sign. |
Qt.ImhUppercaseOnly | Only upper case letter input is allowed. |
Qt.ImhLowercaseOnly | Only lower case letters are allowed. |
Qt.ImhDialableCharactersOnly | Only characters suitable for phone dialing are allowed. |
Qt.ImhEmailCharactersOnly | Only characters suitable for email addresses are allowed. |
Qt.ImhUrlCharactersOnly | Only characters suitable for URLs are allowed. |
Masks:
Constant | Description |
---|---|
Qt.ImhExclusiveInputMask | This mask yields nonzero if any of the exclusive flags are used. |
Signal Documentation
accepted() |
This signal is emitted when the Return or Enter key is pressed.
Note: The corresponding handler is onAccepted
.
textEdited() |
This signal is emitted whenever the text is edited. Unlike onTextChanged()
, this signal is not emitted when the text is changed programmatically, for example, either changing the value of the text
property or calling clear()
.
Note: The corresponding handler is onTextEdited
.
Method Documentation
clear() |
Clears the contents of the text input. Use this method instead of setting the text property to an empty string.
Available under certain Qt licenses.
Find out more.