TextField QML Type▲
-
Import Statement: import QtQuick.Controls
-
Inherits: TextInput
-
Group: TextField is part of qtquickcontrols-input
Detailed Description▲
TextField is a single line text editor. TextField extends TextInput with a placeholder text functionality, and adds decoration.
![]() |
A text field in its normal state. |
![]() |
A text field that has active focus. |
![]() |
A text field that is disabled. |
TextField {
placeholderText
:
qsTr("Enter name"
)
}
See Also▲
See also TextArea, Customizing TextField, Input Controls
Property Documentation▲
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).
See Also▲
See also Customizing TextField
[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).
See Also▲
See also Control Layout, topInset
focusReason : enumeration▲
This property holds the reason of the last focus change.
This property does not indicate whether the item has active focus, but the reason why the item 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. |