C

TextInput QML Type

Displays an editable text paragraph. More...

Import Statement: import QtQuick
Since: Qt Quick Ultralite 2.8

Properties

Signals

Methods

Detailed Description

The TextInput type displays a single paragraph of editable plain text. Use it to accept a single paragraph as input.

See the text input example documentation for more info. about font and key event handling.

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:

ConstantDescription
Qt.ImhHiddenTextCharacters should be hidden, as is typically used when entering passwords.
Qt.ImhSensitiveDataTyped text should not be stored by the active input method in any persistent storage like predictive user dictionary.
Qt.ImhNoAutoUppercaseThe input method should not try to automatically switch to upper case when a sentence ends.
Qt.ImhPreferNumbersNumbers are preferred (but not required).
Qt.ImhPreferUppercaseUpper case letters are preferred (but not required).
Qt.ImhPreferLowercaseLower case letters are preferred (but not required).
Qt.ImhNoPredictiveTextDo not use predictive text (i.e. dictionary lookup) while typing.
Qt.ImhDateThe text editor functions as a date field.
Qt.ImhTimeThe text editor functions as a time field.

Flags that restrict input (exclusive flags) are:

ConstantDescription
Qt.ImhDigitsOnlyOnly digits are allowed.
Qt.ImhFormattedNumbersOnlyOnly number input is allowed. This includes decimal point and minus sign.
Qt.ImhUppercaseOnlyOnly upper case letter input is allowed.
Qt.ImhLowercaseOnlyOnly lower case letters are allowed.
Qt.ImhDialableCharactersOnlyOnly characters suitable for phone dialing are allowed.
Qt.ImhEmailCharactersOnlyOnly characters suitable for email addresses are allowed.
Qt.ImhUrlCharactersOnlyOnly characters suitable for URLs are allowed.

Masks:

ConstantDescription
Qt.ImhExclusiveInputMaskThis mask yields nonzero if any of the exclusive flags are used.

text : string

This property holds the text in TextInput.

See also clear().


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.