TpTabWidget 类
V0.2.1TpGUIWidgets
2025-11-04
介绍
菜单在底部的桌面tab
继承关系
基础信息
| 头文件: | include <TpTabWidget.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | TpWidget |
| 派生类: |
信号
| 信号名称 | 参数 | 描述 |
|---|---|---|
| indexChanged | int32_t |
Public 成员函数
| TpTabWidget(TpWidget *parent=nullptr) | ||
|---|---|---|
| ~TpTabWidget() | ||
| addTab(TpWidget *widget, const TpString &text) | 添加一个tab页 | |
| insertTab(int32_t index, TpWidget *widget, const TpString &text) | 插入一个tab页 | |
| removeTab(int32_t index) | 指定索引删除指定tab,tab对应的外部窗体不会释放 | |
| TpString | tabText(int32_t index) const | 指定索引获取tab标题文本 |
| setTabText(int32_t index, const TpString &text) | 指定索引设置tab标题文本 | |
| currentIndex() const | 获取当前选中索引 | |
| TpWidget * | currentWidget() const | 获取当前选中的索引对应的widget,无则返回nullptr |
| TpWidget * | widget(int32_t index) const | 指定索引获取对应的窗体指针,无则返回nullptr |
| indexOf(TpWidget *widget) const | 指定窗体指针获取对应的索引值 | |
| count() const | 获取总数量 | |
| clear() | 清除所有tab,所有外部给入的指针不会释放 | |
| TpTabBar * | tabBar() const | 获取tab窗口的bar |
| setCurrentIndex(int32_t index) | 设置当前选中索引 | |
| setCurrentWidget(TpWidget *widget) | 设置当前选中widget | |
| onResizeEvent(TpResizeEvent *event) override | ||
| onMoveEvent(TpMoveEvent *event) override | ||
| onPaintEvent(TpPaintEvent *event) override | 绘制事件,禁止在该函数调用 paint和update函数 | |
| eventFilter(TpObject *watched, TpEvent *event) override | 事件过滤器处理函数,对象事件会先进入事件过滤器对象的本函数 |
成员函数说明
TpTabWidget::TpTabWidget(TpWidget *parent=nullptr)
暂无注释...
virtual TpTabWidget::~TpTabWidget()
暂无注释...
int32_t TpTabWidget::addTab(TpWidget *widget, const TpString &text)
添加一个tab页...
添加一个tab页
参数:widget: 该页对应的窗口
参数:text: tab文本
返回值:tab索引
int32_t TpTabWidget::insertTab(int32_t index, TpWidget *widget, const TpString &text)
插入一个tab页...
插入一个tab页
参数:index: 插入的索引,从0开始
参数:widget: 该页对应的窗口
参数:text: tab文本
返回值:tab索引
void TpTabWidget::removeTab(int32_t index)
指定索引删除指定tab,tab对应的外部窗体不会释放...
指定索引删除指定tab,tab对应的外部窗体不会释放
参数:index: tab索引
TpString TpTabWidget::tabText(int32_t index) const
指定索引获取tab标题文本...
指定索引获取tab标题文本
参数:index: 索引
返回值:文本
void TpTabWidget::setTabText(int32_t index, const TpString &text)
指定索引设置tab标题文本...
指定索引设置tab标题文本
参数:index: 索引值
参数:text: 标题文本
int32_t TpTabWidget::currentIndex() const
获取当前选中索引...
获取当前选中索引
返回值:索引值
TpWidget * TpTabWidget::currentWidget() const
获取当前选中的索引对应的widget,无则返回nullptr...
获取当前选中的索引对应的widget,无则返回nullptr
返回值:窗体指针
TpWidget * TpTabWidget::widget(int32_t index) const
指定索引获取对应的窗体指针,无则返回nullptr...
指定索引获取对应的窗体指针,无则返回nullptr
参数:index: 索引值
返回值:窗体指针
int32_t TpTabWidget::indexOf(TpWidget *widget) const
指定窗体指针获取对应的索引值...
指定窗体指针获取对应的索引值
参数:widget: 窗体指针
返回值:查询到的索引,查询失败返回-1
int32_t TpTabWidget::count() const
获取总数量...
获取总数量
返回值:总数量
void TpTabWidget::clear()
清除所有tab,所有外部给入的指针不会释放...
清除所有tab,所有外部给入的指针不会释放
TpTabBar * TpTabWidget::tabBar() const
获取tab窗口的bar...
获取tab窗口的bar
返回值:tabbar指针
void TpTabWidget::setCurrentIndex(int32_t index)
设置当前选中索引...
设置当前选中索引
参数:index: 索引值
void TpTabWidget::setCurrentWidget(TpWidget *widget)
设置当前选中widget...
设置当前选中widget
参数:widget: 窗体指针
virtual bool TpTabWidget::onResizeEvent(TpResizeEvent *event) override
暂无注释...
virtual bool TpTabWidget::onMoveEvent(TpMoveEvent *event) override
暂无注释...
virtual bool TpTabWidget::onPaintEvent(TpPaintEvent *event) override
绘制事件,禁止在该函数调用 paint和update函数...
绘制事件,禁止在该函数调用 paint和update函数
参数:event: 绘制事件指针
返回值:返回true继续执行子控件绘制
virtual bool TpTabWidget::eventFilter(TpObject *watched, TpEvent *event) override
事件过滤器处理函数,对象事件会先进入事件过滤器对象的本函数...
事件过滤器处理函数,对象事件会先进入事件过滤器对象的本函数
参数:watched: 触发事件的对象指针
参数:event: 事件指针
返回值:如果返回true则不再触发watched对象本身的事件回调,返回false则本函数执行完毕后会执行watched对象的事件回调
