pyqt5-QTabWidget标签页组件

1、介绍

QTabWidget,标签页组件。

2、基础使用

clear(self) 
  • 清除所有子页面
addTab(self, widget: QWidget, a1: str) -> int
addTab(self, widget: QWidget, icon: QIcon, label: str) -> int
  • 添加子页面
insertTab(self, index: int, widget: QWidget, a2: str) -> int
insertTab(self, index: int, widget: QWidget, icon: QIcon, label: str) -> int
  • 插入子页面
removeTab(self, index: int) 
  • 移除指定子页面
setTabText(self, index: int, a1: str)
  • 设置指定子页面的标签文本
setTabIcon(self, index: int, icon: QIcon)
  • 设置指定子页面的标签图片
tabText(self, index: int) -> str 
  • 获取指定子页面的标签文本
tabIcon(self, index: int) -> QIcon 
  • 获取指定子页面的标签图片
indexOf(self, widget: QWidget) -> int
  • 获取指定子页面组件的序号
setCurrentIndex(self, index: int)
  • 设置当前的子页面
currentIndex(self) -> int
  • 获取当前的子页面序号
setCurrentWidget(self, widget: QWidget)
  • 设置当前的子页面组件
currentWidget(self) -> QWidget 
  • 获取当前的子页面组件

3、事件

currentChanged(self, index: int) [signal] 
  • 当前子页面切换时,触发
  • index是切换后的索引
posted @ 2023-10-01 02:15  挖洞404  阅读(230)  评论(0编辑  收藏  举报