tab_view¶
Module Contents¶
Tab close button display mode |
|
Tab tool button |
|
Tab item |
|
Tab bar |
|
|
decorator for index checking |
- class TabCloseButtonDisplayMode¶
Bases:
enum.EnumTab close button display mode
- ALWAYS = 0¶
- ON_HOVER = 1¶
- NEVER = 2¶
- checkIndex(*default)¶
decorator for index checking
Parameters¶
- *default:
the default value returned when an index overflow
- class TabToolButton(parent: PyQt5.QtWidgets.QWidget = None)¶
Bases:
qfluentwidgets.components.widgets.button.TransparentToolButtonTab tool button
- class TabItem(parent: PyQt5.QtWidgets.QWidget = None)¶
Bases:
qfluentwidgets.components.widgets.button.PushButtonTab item
- closed¶
- doubleClicked¶
- slideTo(x: int, duration=250)¶
- setShadowEnabled(isEnabled: bool)¶
set whether the shadow is enabled
- setRouteKey(key: str)¶
- routeKey()¶
- setBorderRadius(radius: int)¶
- setSelected(isSelected: bool)¶
- setCloseButtonDisplayMode(mode: TabCloseButtonDisplayMode)¶
set close button display mode
- setTextColor(color: PyQt5.QtGui.QColor)¶
- setSelectedBackgroundColor(light: PyQt5.QtGui.QColor, dark: PyQt5.QtGui.QColor)¶
set background color in selected state
- resizeEvent(e)¶
- enterEvent(e)¶
- leaveEvent(e)¶
- mousePressEvent(e)¶
- mouseMoveEvent(e)¶
- mouseReleaseEvent(e)¶
- mouseDoubleClickEvent(e: PyQt5.QtGui.QMouseEvent)¶
- sizeHint()¶
- paintEvent(e)¶
- class TabBar(parent=None)¶
Bases:
qfluentwidgets.components.widgets.scroll_area.SingleDirectionScrollAreaTab bar
- currentChanged¶
- tabBarClicked¶
- tabBarDoubleClicked¶
- tabCloseRequested¶
- tabAddRequested¶
- tabMoved¶
- dragPos¶
- isDraging = False¶
- lightSelectedBackgroundColor¶
- darkSelectedBackgroundColor¶
- closeButtonDisplayMode¶
- view¶
- hBoxLayout¶
- itemLayout¶
- widgetLayout¶
- addButton¶
- setAddButtonVisible(isVisible: bool)¶
- addTab(routeKey: str, text: str, icon: 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
- insertTab(index: int, routeKey: str, text: str, icon: 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
- removeTab(index: int)¶
- removeTabByKey(routeKey: str)¶
- setCurrentIndex(index: int)¶
set current index
- setCurrentTab(routeKey: str)¶
- currentIndex()¶
- currentTab()¶
- setCloseButtonDisplayMode(mode: TabCloseButtonDisplayMode)¶
set close button display mode
- tabItem(index: int)¶
- tab(routeKey: str)¶
- tabRegion() PyQt5.QtCore.QRect¶
return the bounding rect of all tabs
- tabRect(index: int)¶
return the visual rectangle of the tab at position index
- tabData(index: int)¶
- setTabData(index: int, data)¶
- tabText(index: int)¶
- tabIcon(index: int)¶
- tabToolTip(index: int)¶
- isTabEnabled(index: int)¶
- setTabEnabled(index: int, isEnabled: bool)¶
- setTabsClosable(isClosable: bool)¶
set whether the tab is closable
- tabsClosable()¶
- setTabIcon(index: int, icon: PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase | str)¶
set tab icon
- setTabText(index: int, text: str)¶
set tab text
- isTabVisible(index: int)¶
- setTabVisible(index: int, isVisible: bool)¶
set the visibility of tab
- setTabTextColor(index: int, color: PyQt5.QtGui.QColor)¶
set the text color of tab item
- setTabToolTip(index: int, toolTip: str)¶
set tool tip of tab
- setTabSelectedBackgroundColor(light: PyQt5.QtGui.QColor, dark: PyQt5.QtGui.QColor)¶
set the background in selected state
- setTabShadowEnabled(isEnabled: bool)¶
set whether the shadow of tab is enabled
- isTabShadowEnabled()¶
- paintEvent(e)¶
- setMovable(movable: bool)¶
- isMovable()¶
- setScrollable(scrollable: bool)¶
- setTabMaximumWidth(width: int)¶
set the maximum width of tab
- setTabMinimumWidth(width: int)¶
set the minimum width of tab
- tabMaximumWidth()¶
- tabMinimumWidth()¶
- isScrollable()¶
- count()¶
returns the number of tabs
- clear()¶
Remove all tabs
- mousePressEvent(e: PyQt5.QtGui.QMouseEvent)¶
- mouseMoveEvent(e: PyQt5.QtGui.QMouseEvent)¶
- mouseReleaseEvent(e)¶
- movable¶
- scrollable¶
- tabMaxWidth¶
- tabMinWidth¶
- tabShadowEnabled¶
- class TabWidget(parent=None)¶
Bases:
PyQt5.QtWidgets.QWidget- currentChanged¶
- tabBarClicked¶
- tabCloseRequested¶
- tabAddRequested¶
- tabBarDoubleClicked¶
- tabBar¶
- stackedWidget¶
- vBoxLayout¶
- addPage(widget: PyQt5.QtWidgets.QWidget, label: str, icon: PyQt5.QtGui.QIcon | str | qfluentwidgets.common.icon.FluentIconBase = None, routeKey=None) int¶
Adds a tab with the given page, icon, and label to the tab widget, and returns the index of the tab in the tab bar.
Parameters¶
- widget: QWidget
the widget in the new tab
- label: str
the title of tab
- icon: str | QIcon | FluentIconBase
the icon of tab
- routeKey: str
the route key of new tab, if not provided, an unique uuid will be generated as route key
Returns¶
- index: int
the index of the tab
- addTab(widget: PyQt5.QtWidgets.QWidget, label: str, icon: PyQt5.QtGui.QIcon | str | qfluentwidgets.common.icon.FluentIconBase = None, routeKey=None) int¶
Adds a tab with the given page, icon, and label to the tab widget, and returns the index of the tab in the tab bar.
Parameters¶
- widget: QWidget
the widget in the new tab
- label: str
the title of tab
- icon: str | QIcon | FluentIconBase
the icon of tab
- routeKey: str
the route key of new tab, if not provided, an unique uuid will be generated as route key
Returns¶
- index: int
the index of the tab
- insertTab(index: int, widget: PyQt5.QtWidgets.QWidget, label: str, icon: PyQt5.QtGui.QIcon | str | qfluentwidgets.common.icon.FluentIconBase = None, routeKey=None) int¶
Inserts a tab with the given label and page into the tab widget at the specified index, and returns the index of the inserted tab in the tab bar.
Parameters¶
- index: int
the index of new tab to be inserted
- widget: QWidget
the widget in the new tab
- label: str
the title of tab
- icon: str | QIcon | FluentIconBase
the icon of tab
- routeKey: str
the route key of new tab, if not provided, an unique uuid will be generated as route key
Returns¶
- index: int
the index of the tab
- removeTab(index: int)¶
Removes the tab at position index from this stack of widgets. The page widget itself is not deleted.
Parameters¶
- index: int
the index of removed widget
- clear()¶
Removes all the pages, but does not delete them.
- widget(index: int)¶
Returns the tab page at index position index or None if the index is out of range.
- currentWidget() PyQt5.QtWidgets.QWidget¶
Returns a pointer to the page currently being displayed.
- currentIndex()¶
Returns the index position of the current tab page, returns -1 if there is no current widget.
- setTabBar(tabBar)¶
Replaces the original tab bar with new one. Note that this must be called before any tabs have been added, or the behavior is undefined.
- isMovable()¶
Returns whether the user can move the tabs within the tabbar area.
- setMovable(movable: bool)¶
- isTabEnabled(index: int)¶
- setTabEnabled(index: int, isEnabled: bool)¶
- isTabVisible(index: int)¶
- setTabVisible(index: int, isVisible: bool)¶
- tabText(index: int)¶
- tabIcon(index: int)¶
- tabToolTip(index: int)¶
- setTabsClosable(closable: bool)¶
- tabsClosable() bool¶
- setTabIcon(index: int, icon: PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase | str)¶
- setTabText(index: int, text: str)¶
- setTabToolTip(index: int, tip: str)¶
- setTabTextColor(index: int, color)¶
- setTabSelectedBackgroundColor(light, dark)¶
- setTabShadowEnabled(enabled: bool)¶
- setScrollable(scrollable: bool)¶
- isScrollable() bool¶
- setTabMaximumWidth(width: int)¶
- setTabMinimumWidth(width: int)¶
- tabMaximumWidth() int¶
- tabMinimumWidth() int¶
- tabData(index: int)¶
- setTabData(index: int, data)¶
- count() int¶
Returns the number of tabs in the tab bar.
- setCurrentIndex(index: int)¶
the index of the tab bar’s visible tab
- setCurrentWidget(widget: PyQt5.QtWidgets.QWidget)¶
Sets the current tab to the tab which contains the given widget.
- setCloseButtonDisplayMode(mode: TabCloseButtonDisplayMode)¶