Skip to content

Breadcrumb

The breadcrumb widget provides hierarchical navigation with clickable path segments.

Preview

FXBreadcrumb

FXBreadcrumb

Bases: FXThemeAware, QWidget

A clickable breadcrumb trail for hierarchical navigation.

This widget provides a navigation breadcrumb with clickable path segments, separator icons, and optional back/forward navigation. Double-click the breadcrumb to switch to edit mode for typing paths.

Parameters:

Name Type Description Default

parent

Optional[QWidget]

Parent widget.

None

separator

str

Icon name for separator between segments.

'chevron_right'

home_icon

str

Icon name for the home/root segment.

'home'

show_navigation

bool

Show back/forward navigation buttons.

False

path_separator

str

Character used to join path segments in edit mode.

'/'

home_path

Optional[List[str]]

Path segments to navigate to when home is clicked. If None, navigates to the first segment only.

None
Signals

segment_clicked: Emitted when a segment is clicked (index, path list). home_clicked: Emitted when the home segment is clicked. path_edited: Emitted when user submits a typed path (raw string). navigated_back: Emitted when navigating back in history. navigated_forward: Emitted when navigating forward in history.

Examples:

>>> breadcrumb = FXBreadcrumb(show_navigation=True)
>>> breadcrumb.set_path(["Home", "Projects", "MyProject", "Assets"])
>>> breadcrumb.segment_clicked.connect(
...     lambda idx, path: print(f"Navigate to: {'/'.join(path[:idx+1])}")
... )
>>> breadcrumb.path_edited.connect(lambda text: print(f"User typed: {text}"))

Methods:

Name Description
append_segment

Append a segment to the path.

can_go_back

Check if back navigation is available.

can_go_forward

Check if forward navigation is available.

clear

Clear the breadcrumb path.

clear_history

Clear the navigation history.

enter_edit_mode

Programmatically enter edit mode.

eventFilter

Handle escape key and focus loss to exit edit mode.

go_back

Navigate to the previous path in history.

go_forward

Navigate to the next path in history.

is_editing

Check if currently in edit mode.

navigate_to

Navigate to a specific path index, removing subsequent segments.

pop_segment

Remove and return the last segment.

set_path

Set the breadcrumb path.

Attributes:

Name Type Description
home_path Optional[List[str]]

Get the home path.

path List[str]

Return the current path segments.

home_path property writable

home_path: Optional[List[str]]

Get the home path.

path property

path: List[str]

Return the current path segments.

append_segment

append_segment(segment: str) -> None

Append a segment to the path.

Parameters:

Name Type Description Default

segment

str

The segment string to append.

required

can_go_back

can_go_back() -> bool

Check if back navigation is available.

can_go_forward

can_go_forward() -> bool

Check if forward navigation is available.

clear

clear() -> None

Clear the breadcrumb path.

clear_history

clear_history() -> None

Clear the navigation history.

enter_edit_mode

enter_edit_mode() -> None

Programmatically enter edit mode.

eventFilter

eventFilter(obj, event)

Handle escape key and focus loss to exit edit mode.

go_back

go_back() -> bool

Navigate to the previous path in history.

Returns:

Type Description
bool

True if navigation occurred, False if at beginning of history.

go_forward

go_forward() -> bool

Navigate to the next path in history.

Returns:

Type Description
bool

True if navigation occurred, False if at end of history.

is_editing

is_editing() -> bool

Check if currently in edit mode.

navigate_to

navigate_to(index: int) -> None

Navigate to a specific path index, removing subsequent segments.

Parameters:

Name Type Description Default

index

int

The index to navigate to.

required

pop_segment

pop_segment() -> Optional[str]

Remove and return the last segment.

Returns:

Type Description
Optional[str]

The removed segment, or None if path is empty.

set_path

set_path(path: List[str], record_history: bool = True) -> None

Set the breadcrumb path.

Parameters:

Name Type Description Default

path

List[str]

List of path segment strings.

required

record_history

bool

Whether to record this path in navigation history.

True