navigation_interface¶
Module Contents¶
侧边导航界面 |
- class NavigationInterface(parent=None, showMenuButton=True, showReturnButton=False, collapsible=True)¶
Bases:
PyQt5.QtWidgets.QWidget侧边导航界面
- 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¶
添加导航菜单项
参数¶
- routKey: str
导航菜单项的唯一名字
- icon: str | QIcon | FluentIconBase
导航菜单项的图标
- text: str
导航菜单项的文本
- onClick: callable
导航菜单项点击信号的槽函数
- selectable: bool
导航菜单项是否可以选中
- position: NavigationItemPosition
导航菜单项的添加位置
- 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)¶
添加自定义导航小部件
参数¶
- routKey: str
导航菜单项的唯一名字
- widget: NavigationWidget
自定义的导航小部件
- onClick: callable
导航菜单项点击信号的槽函数
- 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
参数¶
- index: int
insert position
- routKey: str
导航菜单项的唯一名字
- icon: str | QIcon | FluentIconBase
导航菜单项的图标
- text: str
导航菜单项的文本
- onClick: callable
导航菜单项点击信号的槽函数
- selectable: bool
导航菜单项是否可以选中
- 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
参数¶
- index: int
insert position
- routKey: str
导航菜单项的唯一名字
- widget: NavigationWidget
自定义的导航小部件
- onClick: callable
导航菜单项点击信号的槽函数
- 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
- addItemHeader(text: str, position=NavigationItemPosition.TOP)¶
add item header for grouping navigation items
参数¶
- 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
参数¶
- 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
参数¶
- 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)¶
添加分隔符
参数¶
- index: int
insert position
- position: NavigationPostion
分隔符的添加位置
- expand(useAni=True)¶
expand navigation panel
- toggle()¶
toggle navigation panel
- setExpandWidth(width: int)¶
设置展开后最大宽度
- 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)¶