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