breadcrumb
_breadcrumb
¶
Navigation breadcrumb widget.
Classes:
| Name | Description |
|---|---|
FXBreadcrumb |
A clickable breadcrumb trail for hierarchical navigation. |
Classes¶
FXBreadcrumb
¶
FXBreadcrumb(
parent: Optional[QWidget] = None,
separator: str = "chevron_right",
home_icon: str = "home",
show_navigation: bool = False,
path_separator: str = "/",
home_path: Optional[List[str]] = None,
)
Bases: FXThemeAware, QWidget
flowchart TD
fxgui.fxwidgets._breadcrumb.FXBreadcrumb[FXBreadcrumb]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._breadcrumb.FXBreadcrumb
click fxgui.fxwidgets._breadcrumb.FXBreadcrumb href "" "fxgui.fxwidgets._breadcrumb.FXBreadcrumb"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
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 |
|---|---|---|---|
|
Optional[QWidget]
|
Parent widget. |
None
|
|
str
|
Icon name for separator between segments. |
'chevron_right'
|
|
str
|
Icon name for the home/root segment. |
'home'
|
|
bool
|
Show back/forward navigation buttons. |
False
|
|
str
|
Character used to join path segments in edit mode. |
'/'
|
|
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. |
enterEvent |
Brighten the strip: the pointer is somewhere over the path. |
enter_edit_mode |
Programmatically enter edit mode. |
eventFilter |
Handle escape key and focus loss to exit edit mode. |
exit_edit_mode |
Close the editor without submitting, as |
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. |
leaveEvent |
Return the strip to its resting fill: the pointer has left |
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. |
Attributes¶
Methods:¶
append_segment
¶
enterEvent
¶
Brighten the strip: the pointer is somewhere over the path.
Brighten rather than fill. The strip carries
STRIP_RESTING_TOKEN at all times, from construction onward, so
what a hover changes is which of two fills it wears -- it is
never bare.
Answered here rather than by a :hover rule in the style,
because such a rule can only ever light the widget the pointer
is DIRECTLY over -- which, once the path is drawn, is a segment
and never the container. Measured: this widget keeps the pointer
through a move onto one of its own segments and reports it lost
only when it leaves for good, which is exactly when the fill
should drop.
eventFilter
¶
Handle escape key and focus loss to exit edit mode.
While the editor is up this widget also filters the application, to catch a press that lands outside it: focus loss alone covers only a press that lands on something focusable, and a press on a heading, a tree's own header or the window's background moves no focus at all -- which left the editor open with the artist looking at a path they had already left.
exit_edit_mode
¶
Close the editor without submitting, as Escape does.
Public because a window-level Escape shortcut is delivered
BEFORE the focused widget sees the key, so this widget's own
Escape handling never fires while such a shortcut exists. A
window that has one asks is_editing() and hands the key over
by calling this.
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. |
leaveEvent
¶
Return the strip to its resting fill: the pointer has left for good. The fill is not removed, only dimmed.