tab_view ======== .. py:module:: qfluentwidgets.components.widgets.tab_view Module Contents --------------- .. autoapisummary:: qfluentwidgets.components.widgets.tab_view.TabCloseButtonDisplayMode qfluentwidgets.components.widgets.tab_view.TabToolButton qfluentwidgets.components.widgets.tab_view.TabItem qfluentwidgets.components.widgets.tab_view.TabBar .. autoapisummary:: qfluentwidgets.components.widgets.tab_view.checkIndex .. py:class:: TabCloseButtonDisplayMode Bases: :py:obj:`enum.Enum` Tab close button display mode .. py:attribute:: ALWAYS :value: 0 .. py:attribute:: ON_HOVER :value: 1 .. py:attribute:: NEVER :value: 2 .. py:function:: checkIndex(*default) decorator for index checking Parameters ---------- *default: the default value returned when an index overflow .. py:class:: TabToolButton(parent: PyQt5.QtWidgets.QWidget = None) Bases: :py:obj:`qfluentwidgets.components.widgets.button.TransparentToolButton` Tab tool button .. py:class:: TabItem(parent: PyQt5.QtWidgets.QWidget = None) Bases: :py:obj:`qfluentwidgets.components.widgets.button.PushButton` Tab item .. py:attribute:: closed .. py:method:: slideTo(x: int, duration=250) .. py:method:: setShadowEnabled(isEnabled: bool) set whether the shadow is enabled .. py:method:: setRouteKey(key: str) .. py:method:: routeKey() .. py:method:: setBorderRadius(radius: int) .. py:method:: setSelected(isSelected: bool) .. py:method:: setCloseButtonDisplayMode(mode: TabCloseButtonDisplayMode) set close button display mode .. py:method:: setTextColor(color: PyQt5.QtGui.QColor) .. py:method:: setSelectedBackgroundColor(light: PyQt5.QtGui.QColor, dark: PyQt5.QtGui.QColor) set background color in selected state .. py:method:: resizeEvent(e) .. py:method:: enterEvent(e) .. py:method:: leaveEvent(e) .. py:method:: mousePressEvent(e) .. py:method:: mouseMoveEvent(e) .. py:method:: mouseReleaseEvent(e) .. py:method:: sizeHint() .. py:method:: paintEvent(e) .. py:class:: TabBar(parent=None) Bases: :py:obj:`qfluentwidgets.components.widgets.scroll_area.SingleDirectionScrollArea` Tab bar .. py:attribute:: currentChanged .. py:attribute:: tabBarClicked .. py:attribute:: tabCloseRequested .. py:attribute:: tabAddRequested .. py:attribute:: items :type: List[TabItem] :value: [] .. py:attribute:: itemMap :type: Dict[str, TabItem] .. py:attribute:: dragPos .. py:attribute:: isDraging :value: False .. py:attribute:: lightSelectedBackgroundColor .. py:attribute:: darkSelectedBackgroundColor .. py:attribute:: closeButtonDisplayMode .. py:attribute:: view .. py:attribute:: hBoxLayout .. py:attribute:: itemLayout .. py:attribute:: widgetLayout .. py:attribute:: addButton .. py:method:: setAddButtonVisible(isVisible: bool) .. py:method:: addTab(routeKey: str, text: str, icon: Union[PyQt5.QtGui.QIcon, str, qfluentwidgets.common.icon.FluentIconBase] = None, onClick=None) add tab Parameters ---------- routeKey: str the unique name of tab item text: str the text of tab item text: str the icon of tab item onClick: callable the slot connected to item clicked signal .. py:method:: insertTab(index: int, routeKey: str, text: str, icon: Union[PyQt5.QtGui.QIcon, str, qfluentwidgets.common.icon.FluentIconBase] = None, onClick=None) insert tab Parameters ---------- index: int the insert position of tab item routeKey: str the unique name of tab item text: str the text of tab item text: str the icon of tab item onClick: callable the slot connected to item clicked signal .. py:method:: removeTab(index: int) .. py:method:: removeTabByKey(routeKey: str) .. py:method:: setCurrentIndex(index: int) set current index .. py:method:: setCurrentTab(routeKey: str) .. py:method:: currentIndex() .. py:method:: currentTab() .. py:method:: setCloseButtonDisplayMode(mode: TabCloseButtonDisplayMode) set close button display mode .. py:method:: tabItem(index: int) .. py:method:: tab(routeKey: str) .. py:method:: tabRegion() -> PyQt5.QtCore.QRect return the bounding rect of all tabs .. py:method:: tabRect(index: int) return the visual rectangle of the tab at position index .. py:method:: tabText(index: int) .. py:method:: tabIcon(index: int) .. py:method:: tabToolTip(index: int) .. py:method:: setTabsClosable(isClosable: bool) set whether the tab is closable .. py:method:: tabsClosable() .. py:method:: setTabIcon(index: int, icon: Union[PyQt5.QtGui.QIcon, qfluentwidgets.common.icon.FluentIconBase, str]) set tab icon .. py:method:: setTabText(index: int, text: str) set tab text .. py:method:: setTabVisible(index: int, isVisible: bool) set the visibility of tab .. py:method:: setTabTextColor(index: int, color: PyQt5.QtGui.QColor) set the text color of tab item .. py:method:: setTabToolTip(index: int, toolTip: str) set tool tip of tab .. py:method:: setTabSelectedBackgroundColor(light: PyQt5.QtGui.QColor, dark: PyQt5.QtGui.QColor) set the background in selected state .. py:method:: setTabShadowEnabled(isEnabled: bool) set whether the shadow of tab is enabled .. py:method:: isTabShadowEnabled() .. py:method:: paintEvent(e) .. py:method:: setMovable(movable: bool) .. py:method:: isMovable() .. py:method:: setScrollable(scrollable: bool) .. py:method:: setTabMaximumWidth(width: int) set the maximum width of tab .. py:method:: setTabMinimumWidth(width: int) set the minimum width of tab .. py:method:: tabMaximumWidth() .. py:method:: tabMinimumWidth() .. py:method:: isScrollable() .. py:method:: count() returns the number of tabs .. py:method:: mousePressEvent(e: PyQt5.QtGui.QMouseEvent) .. py:method:: mouseMoveEvent(e: PyQt5.QtGui.QMouseEvent) .. py:method:: mouseReleaseEvent(e) .. py:attribute:: movable .. py:attribute:: scrollable .. py:attribute:: tabMaxWidth .. py:attribute:: tabMinWidth .. py:attribute:: tabShadowEnabled