inputs
_inputs
¶
Input widgets with icons.
Classes:
| Name | Description |
|---|---|
FXIconLineEdit |
A line edit that displays an icon on the left or right side. |
FXPasswordLineEdit |
A custom widget that includes a password line edit with a show/hide button. |
FXValidatedLineEdit |
A line edit that provides visual feedback when input is rejected. |
Classes¶
FXIconLineEdit
¶
FXIconLineEdit(
icon_name: Optional[str] = None,
icon_position: str = "left",
parent: Optional[QWidget] = None,
)
Bases: FXThemeAware, QLineEdit
flowchart TD
fxgui.fxwidgets._inputs.FXIconLineEdit[FXIconLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXIconLineEdit
click fxgui.fxwidgets._inputs.FXIconLineEdit href "" "fxgui.fxwidgets._inputs.FXIconLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A line edit that displays an icon on the left or right side.
The icon is theme-aware and will refresh automatically when the application theme changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[str]
|
The name of the icon to display. |
None
|
|
str
|
The position of the icon ('left' or 'right'). |
'left'
|
|
Optional[QWidget]
|
The parent widget. |
None
|
Methods:
| Name | Description |
|---|---|
resizeEvent |
Reposition the icon when the line edit is resized. |
FXPasswordLineEdit
¶
FXPasswordLineEdit(
parent: Optional[QWidget] = None, icon_position: str = "right"
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets._inputs.FXPasswordLineEdit[FXPasswordLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXPasswordLineEdit
click fxgui.fxwidgets._inputs.FXPasswordLineEdit href "" "fxgui.fxwidgets._inputs.FXPasswordLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A custom widget that includes a password line edit with a show/hide button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
The parent widget. |
None
|
|
str
|
The position of the icon ('left' or 'right'). |
'right'
|
Methods:
| Name | Description |
|---|---|
toggle_reveal |
Toggles the echo mode between password and normal, and changes the |
FXValidatedLineEdit
¶
FXValidatedLineEdit(
parent: Optional[QWidget] = None,
shake_amplitude: int = 4,
shake_duration: int = 300,
flash_duration: int = 400,
)
Bases: FXThemeAware, QLineEdit
flowchart TD
fxgui.fxwidgets._inputs.FXValidatedLineEdit[FXValidatedLineEdit]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._inputs.FXValidatedLineEdit
click fxgui.fxwidgets._inputs.FXValidatedLineEdit href "" "fxgui.fxwidgets._inputs.FXValidatedLineEdit"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A line edit that provides visual feedback when input is rejected.
When a validator rejects input (e.g., typing an invalid character), this widget shows a brief shake animation with a red border flash to indicate to the user that their input was not accepted.
The error color is theme-aware and uses the feedback "error" color from the current theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
The parent widget. |
None
|
|
int
|
Maximum horizontal displacement in pixels. |
4
|
|
int
|
Total duration of shake animation in milliseconds. |
300
|
|
int
|
Duration of red border flash in milliseconds. |
400
|
Examples:
>>> from qtpy.QtWidgets import QLineEdit
>>> from fxgui.fxwidgets import FXValidatedLineEdit, FXCamelCaseValidator
>>> line_edit = FXValidatedLineEdit()
>>> line_edit.setValidator(FXCamelCaseValidator())
>>> line_edit.setPlaceholderText("camelCase only")
Methods:
| Name | Description |
|---|---|
keyPressEvent |
Intercept key presses to detect rejected input. |