IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

TextField QML Type

Single-line text input field.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

TextField QML Type

  • Import Statement: import QtQuick.Controls

  • Inherits:: TextInput

  • Group: TextField is part of qtquickcontrols-input

I. Detailed Description

TextField is a single line text editor. TextField extends TextInput with a placeholder text functionality, and adds decoration.

Image non disponible

A text field in its normal state.

Image non disponible

A text field that has active focus.

Image non disponible

A text field that is disabled.

 
Sélectionnez
TextField {
    placeholderText: qsTr("Enter name")
}

I-1. See Also

II. Property Documentation

 

II-1. background : Item

This property holds the background item.

If the background item has no explicit size specified, it automatically follows the control's size. In most cases, there is no need to specify width or height for a background item.

Most controls use the implicit size of the background item to calculate the implicit size of the control itself. If you replace the background item with a custom one, you should also consider providing a sensible implicit size for it (unless it is an item like Image which has its own implicit size).

II-1-1. See Also

II-2. [since QtQuick.Controls 2.5 (Qt 5.12)] bottomInset : real

This property holds the bottom inset for the background.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-2-1. See Also

II-3. focusReason : enumeration

This property holds the reason of the last focus change.

This property does not indicate whether the control has active focus, but the reason why the control either gained or lost focus.

Constant

Description

Qt.MouseFocusReason

A mouse action occurred.

Qt.TabFocusReason

The Tab key was pressed.

Qt.BacktabFocusReason

A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.

Qt.ActiveWindowFocusReason

The window system made this window either active or inactive.

Qt.PopupFocusReason

The application opened/closed a pop-up that grabbed/released the keyboard focus.

Qt.ShortcutFocusReason

The user typed a label's buddy shortcut

Qt.MenuBarFocusReason

The menu bar took focus.

Qt.OtherFocusReason

Another reason, usually application-specific.

II-3-1. See Also

II-4. [since QtQuick.Controls 2.1 (Qt 5.8)] hoverEnabled : bool

This property determines whether the text field accepts hover events. The default value is false.

This property was introduced in QtQuick.Controls 2.1 (Qt 5.8).

II-4-1. See Also

See also hovered

II-5. [read-only, since QtQuick.Controls 2.1 (Qt 5.8)] hovered : bool

This property holds whether the text field is hovered.

This property was introduced in QtQuick.Controls 2.1 (Qt 5.8).

II-5-1. See Also

See also hoverEnabled

II-6. [read-only, since QtQuick.Controls 2.5 (Qt 5.12)] implicitBackgroundHeight : real

This property holds the implicit background height.

The value is equal to background ? background.implicitHeight : 0.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-6-1. See Also

II-7. [read-only, since QtQuick.Controls 2.5 (Qt 5.12)] implicitBackgroundWidth : real

This property holds the implicit background width.

The value is equal to background ? background.implicitWidth : 0.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-7-1. See Also

II-8. [since QtQuick.Controls 2.5 (Qt 5.12)] leftInset : real

This property holds the left inset for the background.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-8-1. See Also

II-9. placeholderText : string

This property holds the hint that is displayed in the TextField before the user enters text.

II-10. [since QtQuick.Controls 2.5 (Qt 5.12)] placeholderTextColor : color

This property holds the color of placeholderText.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-10-1. See Also

See also placeholderText

II-11. [since QtQuick.Controls 2.5 (Qt 5.12)] rightInset : real

This property holds the right inset for the background.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-11-1. See Also

II-12. [since QtQuick.Controls 2.5 (Qt 5.12)] topInset : real

This property holds the top inset for the background.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

II-12-1. See Also

III. Signal Documentation

 

III-1. pressAndHold(MouseEvent event)

This signal is emitted when there is a long press (the delay depends on the platform plugin). The event parameter provides information about the press, including the x and y coordinates of the press, and which button is pressed.

The corresponding handler is onPressAndHold.

III-1-1. See Also

See also pressed, released

III-2. [since QtQuick.Controls 2.1 (Qt 5.8)] pressed(MouseEvent event)

This signal is emitted when the text field is pressed by the user. The event parameter provides information about the press, including the x and y coordinates of the press, and which button is pressed.

The corresponding handler is onPressed.

This signal was introduced in QtQuick.Controls 2.1 (Qt 5.8).

III-2-1. See Also

III-3. [since QtQuick.Controls 2.1 (Qt 5.8)] released(MouseEvent event)

This signal is emitted when the text field is released by the user. The event parameter provides information about the release, including the x and y coordinates of the press, and which button is pressed.

The corresponding handler is onReleased.

This signal was introduced in QtQuick.Controls 2.1 (Qt 5.8).

III-3-1. See Also

See also pressed, pressAndHold

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+