navigation_interface#

Module Contents#

NavigationInterface

侧边导航界面

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

Bases: PyQt5.QtWidgets.QWidget

侧边导航界面

displayModeChanged#
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

addSeparator(position=NavigationItemPosition.TOP)#

添加分隔符

参数#

position: NavigationPostion

分隔符的添加位置

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

添加分隔符

参数#

index: int

insert position

position: NavigationPostion

分隔符的添加位置

removeWidget(routeKey: str)#

移除小部件

参数#

routKey: str

导航菜单项的唯一名字

setCurrentItem(name: str)#

设置当前选中的导航项

参数#

name: str

导航菜单项的唯一名字

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

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