Skip to content

search_bar

Enhanced search input widget.

Classes:

Name Description
FXSearchBar

An enhanced search input widget with built-in features.

Classes

FXSearchBar

FXSearchBar(
    parent: Optional[QWidget] = None,
    placeholder: str = "Search...",
    debounce_ms: int = 300,
    show_filter: bool = False,
    filters: Optional[list] = None,
)

Bases: FXThemeAware, QWidget


              flowchart TD
              fxgui.fxwidgets._search_bar.FXSearchBar[FXSearchBar]
              fxgui.fxstyle.FXThemeAware[FXThemeAware]

                              fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._search_bar.FXSearchBar
                


              click fxgui.fxwidgets._search_bar.FXSearchBar href "" "fxgui.fxwidgets._search_bar.FXSearchBar"
              click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
            

An enhanced search input widget with built-in features.

This widget provides a search input with: - Search icon - Clear button - Optional filter dropdown - Debounced search signal for live filtering

Parameters:

Name Type Description Default
parent
Optional[QWidget]

Parent widget.

None
placeholder
str

Placeholder text.

'Search...'
debounce_ms
int

Debounce delay in milliseconds for search_changed signal.

300
show_filter
bool

Whether to show the filter dropdown.

False
filters
Optional[list]

List of filter options for the dropdown.

None
Signals

search_changed: Emitted when the search text changes (debounced). search_submitted: Emitted when Enter is pressed. filter_changed: Emitted when the filter selection changes.

Examples:

>>> search = FXSearchBar(placeholder="Search assets...")
>>> search.search_changed.connect(lambda text: print(f"Searching: {text}"))
>>> search.set_filters(["All", "Models", "Textures", "Materials"])

Methods:

Name Description
clear

Clear the search input.

setFocus

Set focus to the search input.

set_filters

Set the filter dropdown options.

set_placeholder

Set the placeholder text.

show_filter

Show or hide the filter dropdown.

Attributes:

Name Type Description
filter str

Return the current filter selection.

text str

Return the current search text.

Attributes
filter property
filter: str

Return the current filter selection.

text property writable
text: str

Return the current search text.

Functions
clear
clear() -> None

Clear the search input.

setFocus
setFocus() -> None

Set focus to the search input.

set_filters
set_filters(filters: list) -> None

Set the filter dropdown options.

Parameters:

Name Type Description Default
filters list

List of filter option strings.

required
set_placeholder
set_placeholder(text: str) -> None

Set the placeholder text.

Parameters:

Name Type Description Default
text str

The placeholder text.

required
show_filter
show_filter(visible: bool = True) -> None

Show or hide the filter dropdown.

Parameters:

Name Type Description Default
visible bool

Whether to show the filter dropdown.

True