navigation_interface

Module Contents

NavigationInterface

Navigation interface

class NavigationInterface(parent=None, showMenuButton=True, showReturnButton=False, collapsible=True)

Bases: PyQt5.QtWidgets.QWidget

Navigation interface

displayModeChanged
panel
addItem(routeKey: str, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase, text: str, onClick=None, selectable=True, position=NavigationItemPosition.TOP, tooltip: str = None, parentRouteKey: str = None) qfluentwidgets.components.navigation.navigation_widget.NavigationTreeWidget

add navigation item

Parameters

routKey: str

the unique name of item

icon: str | QIcon | FluentIconBase

the icon of navigation item

text: str

the text of navigation item

onClick: callable

the slot connected to item clicked signal

selectable: bool

whether the item is selectable

position: NavigationItemPosition

where the button is added

tooltip: str

the tooltip of item

parentRouteKey: str

the route key of parent item, the parent item should be NavigationTreeWidgetBase

addWidget(routeKey: str, widget: qfluentwidgets.components.navigation.navigation_panel.NavigationWidget, onClick=None, position=NavigationItemPosition.TOP, tooltip: str = None, parentRouteKey: str = None)

add custom widget

Parameters

routKey: str

the unique name of item

widget: NavigationWidget

the custom widget to be added

onClick: callable

the slot connected to item clicked signal

position: NavigationItemPosition

where the widget is added

tooltip: str

the tooltip of widget

parentRouteKey: str

the route key of parent item, the parent item should be NavigationTreeWidgetBase

insertItem(index: int, routeKey: str, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase, text: str, onClick=None, selectable=True, position=NavigationItemPosition.TOP, tooltip: str = None, parentRouteKey: str = None) qfluentwidgets.components.navigation.navigation_widget.NavigationTreeWidget

insert navigation item

Parameters

index: int

insert position

routKey: str

the unique name of item

icon: str | QIcon | FluentIconBase

the icon of navigation item

text: str

the text of navigation item

onClick: callable

the slot connected to item clicked signal

selectable: bool

whether the item is selectable

position: NavigationItemPosition

where the item is added

tooltip: str

the tooltip of item

parentRouteKey: str

the route key of parent item, the parent item should be NavigationTreeWidgetBase

insertWidget(index: int, routeKey: str, widget: qfluentwidgets.components.navigation.navigation_panel.NavigationWidget, onClick=None, position=NavigationItemPosition.TOP, tooltip: str = None, parentRouteKey: str = None)

insert custom widget

Parameters

index: int

insert position

routKey: str

the unique name of item

widget: NavigationWidget

the custom widget to be added

onClick: callable

the slot connected to item clicked signal

position: NavigationItemPosition

where the widget is added

tooltip: str

the tooltip of widget

parentRouteKey: str

the route key of parent item, the parent item should be NavigationTreeWidgetBase

addSeparator(position=NavigationItemPosition.TOP)

add separator

Parameters

position: NavigationPostion

where to add the separator

addItemHeader(text: str, position=NavigationItemPosition.TOP)

add item header for grouping navigation items

Parameters

text: str

header text to display

position: NavigationItemPosition

where the header is added

Returns

NavigationItemHeader

created header widget

insertItemHeader(index: int, text: str, position=NavigationItemPosition.TOP)

insert item header for grouping navigation items

Parameters

index: int

insert position

text: str

header text to display

position: NavigationItemPosition

where the header is added

Returns

NavigationItemHeader

created header widget

addUserCard(routeKey: str, avatar: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase = None, title: str = '', subtitle: str = '', onClick=None, position=NavigationItemPosition.TOP, aboveMenuButton: bool = False)

add user card to navigation panel

Parameters

routeKey: str

the unique name of user card

avatar: str | QIcon | FluentIconBase

avatar image or icon

title: str

user name or title text

subtitle: str

subtitle text (e.g., email, status)

onClick: callable

the slot connected to card clicked signal

position: NavigationItemPosition

where the card is added

aboveMenuButton: bool

whether to place the card above the menu button (expand/collapse button)

Returns

NavigationUserCard

created user card widget

insertSeparator(index: int, position=NavigationItemPosition.TOP)

add separator

Parameters

index: int

insert position

position: NavigationPostion

where to add the separator

removeWidget(routeKey: str)

remove widget

Parameters

routKey: str

the unique name of item

setCurrentItem(name: str)

set current selected item

Parameters

name: str

the unique name of item

expand(useAni=True)

expand navigation panel

toggle()

toggle navigation panel

setExpandWidth(width: int)

set the maximum width

setMinimumExpandWidth(width: int)

Set the minimum window width that allows panel to be expanded

setMenuButtonVisible(isVisible: bool)

set whether the menu button is visible

setReturnButtonVisible(isVisible: bool)

set whether the return button is visible

setCollapsible(collapsible: bool)
isAcrylicEnabled()
setAcrylicEnabled(isEnabled: bool)

set whether the acrylic background effect is enabled

isIndicatorAnimationEnabled()
setIndicatorAnimationEnabled(isEnabled: bool)

set whether the indicator sliding animation is enabled

isUpdateIndicatorPosOnCollapseFinished()
setUpdateIndicatorPosOnCollapseFinished(update: bool)

set whether to update indicator position when collapese finished

widget(routeKey: str)
eventFilter(obj, e: PyQt5.QtCore.QEvent)
resizeEvent(e: PyQt5.QtGui.QResizeEvent)