tag_input
_tag_input
¶
Tag/chip input widget.
Classes:
| Name | Description |
|---|---|
FXTagChip |
A single removable tag chip. |
FXTagInput |
A styled input widget that displays tags as removable chips. |
Classes¶
FXTagChip
¶
Bases: FXThemeAware, QFrame
flowchart TD
fxgui.fxwidgets._tag_input.FXTagChip[FXTagChip]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._tag_input.FXTagChip
click fxgui.fxwidgets._tag_input.FXTagChip href "" "fxgui.fxwidgets._tag_input.FXTagChip"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A single removable tag chip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The tag text. |
required |
|
Optional[QWidget]
|
Parent widget. |
None
|
|
bool
|
Whether the chip can be removed. |
True
|
Signals
removed: Emitted when the remove button is clicked.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
Return the tag text. |
FXTagInput
¶
FXTagInput(
parent: Optional[QWidget] = None,
placeholder: str = "Add tag and press Enter...",
max_tags: int = 0,
allow_duplicates: bool = False,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets._tag_input.FXTagInput[FXTagInput]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._tag_input.FXTagInput
click fxgui.fxwidgets._tag_input.FXTagInput href "" "fxgui.fxwidgets._tag_input.FXTagInput"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
A styled input widget that displays tags as removable chips.
This widget provides an input field where users can type and press Enter to add tags. Tags are displayed as styled chips that can be removed by clicking the × button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Placeholder text for the input field. |
'Add tag and press Enter...'
|
|
int
|
Maximum number of tags allowed (0 = unlimited). |
0
|
|
bool
|
Whether duplicate tags are allowed. |
False
|
Signals
tags_changed: Emitted when tags are added or removed. tag_added: Emitted when a single tag is added. tag_removed: Emitted when a single tag is removed.
Examples:
>>> tag_input = FXTagInput(placeholder="Add tags...")
>>> tag_input.tags_changed.connect(lambda tags: print(f"Tags: {tags}"))
>>> tag_input.add_tag("python")
>>> tag_input.add_tag("qt")
Methods:
| Name | Description |
|---|---|
add_tag |
Add a tag to the input. |
clear_tags |
Remove all tags. |
remove_tag |
Remove a tag from the input. |
set_tags |
Set the tags, replacing any existing tags. |
Attributes:
| Name | Type | Description |
|---|---|---|
tags |
List[str]
|
Return the list of current tags. |