TpLayout 类
V0.2.1TpGUIWidgets
2025-11-14
继承关系
基础信息
| 头文件: | include <TpLayout.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | TpObject |
| 派生类: | TpBoxLayout TpFlexLayout TpGridLayout |
信号
| 信号名称 | 参数 | 描述 |
|---|---|---|
| onUpdate | 布局更新事件 |
Public 成员函数
| TpLayout(TpWidget *parent=nullptr) | ||
|---|---|---|
| ~TpLayout() | ||
| addWidget(TpWidget *widget, int stretch=1) | 向布局内添加窗口 | |
| addLayout(TpLayout *layout, int stretch=1) | 向布局内添加布局 | |
| insertWidget(uint32_t index, TpWidget *widget, int stretch=1) | 插入一个窗口 | |
| insertLayout(uint32_t index, TpLayout *layout, int stretch=1) | 插入一个布局 | |
| removeWidget(TpWidget *widget) | 从布局移除一个指定widget,不会释放指针 | |
| removeLayout(TpLayout *layout) | 从布局移除一个子布局,不会释放指针 | |
| addSpacer(TpSpacerItem *spacer) | 添加一个弹簧 | |
| setContentsMargins(int32_t left, int32_t top, int32_t right, int32_t bottom) | 设置布局距离外边界距离(px) | |
| contentsMargins(int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) const | 获取布局距离外边界距离(px) | |
| setSpacing(int spacing) | 设置间距 | |
| spacing() const | 获取布局间距 | |
| update() | 布局刷新 | |
| rowCount() | 获取布局当前行数 | |
| columnCount() | 获取布局当前列数 | |
| clear() | 清空布局内所有子部件 | |
| virtual TpVector< TpObject * > | children() | 获取子控件列表 |
| virtual TpSize | minumumSize() | 获取布局的最小尺寸;内部根据布局内子控件计算布局的最小尺寸 |
成员函数说明
TpLayout::TpLayout(TpWidget *parent=nullptr)
暂无注释...
virtual TpLayout::~TpLayout()
暂无注释...
virtual void TpLayout::addWidget(TpWidget *widget, int stretch=1)
向布局内添加窗口...
向布局内添加窗口
参数:widget: 窗口指针
参数:stretch: 缩放比例
virtual void TpLayout::addLayout(TpLayout *layout, int stretch=1)
向布局内添加布局...
向布局内添加布局
参数:layout: 布局指针
参数:stretch: 缩放比例
virtual void TpLayout::insertWidget(uint32_t index, TpWidget *widget, int stretch=1)
插入一个窗口...
插入一个窗口
参数:index: 插入索引,从0开始
参数:widget: 窗口指针
参数:stretch: 缩放比例
virtual void TpLayout::insertLayout(uint32_t index, TpLayout *layout, int stretch=1)
插入一个布局...
插入一个布局
参数:index: 插入索引,从0开始
参数:layout: 布局指针
参数:stretch: 缩放比例
virtual void TpLayout::removeWidget(TpWidget *widget)
从布局移除一个指定widget,不会释放指针...
从布局移除一个指定widget,不会释放指针
参数:widget: widget指针
virtual void TpLayout::removeLayout(TpLayout *layout)
从布局移除一个子布局,不会释放指针...
从布局移除一个子布局,不会释放指针
参数:layout: 布局指针
virtual void TpLayout::addSpacer(TpSpacerItem *spacer)
添加一个弹簧...
添加一个弹簧
参数:spacer: 弹簧指针
virtual void TpLayout::setContentsMargins(int32_t left, int32_t top, int32_t right, int32_t bottom)
设置布局距离外边界距离(px)...
设置布局距离外边界距离(px)
参数:left: 距离左边界距离
参数:top: 距离上边界距离
参数:right: 距离右边界距离
参数:bottom: 距离下边界距离
virtual void TpLayout::contentsMargins(int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) const
获取布局距离外边界距离(px)...
获取布局距离外边界距离(px)
参数:left: 距离左边界距离
参数:top: 距离上边界距离
参数:right: 距离右边界距离
参数:bottom: 距离下边界距离
virtual void TpLayout::setSpacing(int spacing)
设置间距...
设置间距
参数:spacing: 间距值,单位px
virtual int TpLayout::spacing() const
获取布局间距...
获取布局间距
返回值:间距值,单位px
virtual void TpLayout::update()
布局刷新...
布局刷新
virtual uint32_t TpLayout::rowCount()
获取布局当前行数...
获取布局当前行数
返回值:布局行数
virtual uint32_t TpLayout::columnCount()
获取布局当前列数...
获取布局当前列数
返回值:布局列数
virtual void TpLayout::clear()
清空布局内所有子部件...
清空布局内所有子部件
virtual TpVector< TpObject * > TpLayout::children()
获取子控件列表...
获取子控件列表
返回值:控件指针列表
virtual TpSize TpLayout::minumumSize()
获取布局的最小尺寸;内部根据布局内子控件计算布局的最小尺寸...
获取布局的最小尺寸;内部根据布局内子控件计算布局的最小尺寸
返回值:最小尺寸
