Breadcrumb¶
The breadcrumb widget provides hierarchical navigation with clickable path segments.
Preview
FXBreadcrumb
¶
Bases: ,
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 widget. |
None
|
|
|
Icon name for separator between segments. |
'chevron_right'
|
|
|
Icon name for the home/root segment. |
'home'
|
|
|
Show back/forward navigation buttons. |
False
|
|
|
Character used to join path segments in edit mode. |
'/'
|
|
|
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 a segment to the path. |
|
Check if back navigation is available. |
|
Check if forward navigation is available. |
|
Clear the breadcrumb path. |
|
Clear the navigation history. |
|
Programmatically enter edit mode. |
|
Handle escape key and focus loss to exit edit mode. |
|
Navigate to the previous path in history. |
|
Navigate to the next path in history. |
|
Check if currently in edit mode. |
|
Navigate to a specific path index, removing subsequent segments. |
|
Remove and return the last segment. |
|
Set the breadcrumb path. |
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Get the home path. |
|
|
Return the current path segments. |
append_segment
¶
Append a segment to the path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The segment string to append. |
required |
go_back
¶
Navigate to the previous path in history.
Returns:
| Type | Description |
|---|---|
|
True if navigation occurred, False if at beginning of history. |
go_forward
¶
Navigate to the next path in history.
Returns:
| Type | Description |
|---|---|
|
True if navigation occurred, False if at end of history. |
navigate_to
¶
Navigate to a specific path index, removing subsequent segments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The index to navigate to. |
required |
pop_segment
¶
Remove and return the last segment.
Returns:
| Type | Description |
|---|---|
|
The removed segment, or None if path is empty. |