TpWeatherInfoPanel 类
V0.2.1TpGUIWidgets
2025-11-14
介绍
天气预报面板
继承关系
基础信息
| 头文件: | include <TpWeatherInfoPanel.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | TpWidget |
| 派生类: |
Public 类型
struct TpWeatherInfoPanel::WeatherInfo
| 类型 | 名称 | 描述 |
|---|---|---|
| TpString | text | 一般用于显示日期,可自定义显示内容;ex: 今天 |
| WeatherType | weatherType | 天气类型 |
| TpString | subText | 一般用于显示气温,可自定义显示内容;ex: 15°-30° |
enum TpWeatherInfoPanel::WeatherType
| 名称 | 值 | 描述 |
|---|---|---|
| Sunny | 0 | 晴天 |
| Cloudy | 1 | 多云 |
| Overcast | 2 | 阴天 |
| LightRain | 3 | 小雨 |
| ModerateRain | 4 | 中雨 |
| HeavyRain | 5 | 大雨 |
| TorrentialRain | 6 | 暴雨 |
| Thunderstorm | 7 | 雷阵雨 |
| LightSnow | 8 | 小雪 |
| ModerateSnow | 9 | 中雪 |
| HeavySnow | 10 | 大雪 |
| Blizzard | 11 | 暴雪 |
| Sleet | 12 | 雨夹雪 |
| Fog | 13 | 雾 |
| Haze | 14 | 雾霾 |
| Sandstorm | 15 | 沙尘暴 |
| Hail | 16 | 冰雹 |
Public 成员函数
| TpWeatherInfoPanel(TpWidget *parent=nullptr) | ||
|---|---|---|
| ~TpWeatherInfoPanel() | ||
| setCount(const int32_t &count=5) | 设置显示天气的数量 | |
| setSelectIndex(const int32_t &index) | 设置当前选中显示的索引 | |
| selectIndex() | 当前选中的索引值 | |
| setWeatherList(const TpVector< WeatherInfo > &weatherInfoList) | 设置天气信息列表;使用前需先设置天气数量 | |
| setWeatherInfo(const int32_t &index, const WeatherInfo &weatherInfo) | 指定索引设置天气信息 | |
| onPaintEvent(TpPaintEvent *event) override | 绘制事件,禁止在该函数调用 paint和update函数 | |
| onResizeEvent(TpResizeEvent *event) override | ||
| virtual TpString | pluginType() override | 组件类名,子类实现,返回子类类名字符串,用于匹配CSS中对应样式 |
成员函数说明
TpWeatherInfoPanel::TpWeatherInfoPanel(TpWidget *parent=nullptr)
暂无注释...
virtual TpWeatherInfoPanel::~TpWeatherInfoPanel()
暂无注释...
void TpWeatherInfoPanel::setCount(const int32_t &count=5)
设置显示天气的数量...
设置显示天气的数量
参数:count: 取值范围[1, 15]
void TpWeatherInfoPanel::setSelectIndex(const int32_t &index)
设置当前选中显示的索引...
设置当前选中显示的索引
参数:index: 索引值,取值范围[0, count - 1]
int32_t TpWeatherInfoPanel::selectIndex()
当前选中的索引值...
当前选中的索引值
返回值:索引值
void TpWeatherInfoPanel::setWeatherList(const TpVector< WeatherInfo > &weatherInfoList)
设置天气信息列表;使用前需先设置天气数量...
设置天气信息列表;使用前需先设置天气数量
参数:weatherInfoList: 若Size为0则设置失败,Size超过count值则只显示Count数
bool TpWeatherInfoPanel::setWeatherInfo(const int32_t &index, const WeatherInfo &weatherInfo)
指定索引设置天气信息...
指定索引设置天气信息
参数:index: 索引值;取值范围[0, count - 1]
参数:weatherInfo: 天气信息
virtual bool TpWeatherInfoPanel::onPaintEvent(TpPaintEvent *event) override
绘制事件,禁止在该函数调用 paint和update函数...
绘制事件,禁止在该函数调用 paint和update函数
参数:event: 绘制事件指针
返回值:返回true继续执行子控件绘制
virtual bool TpWeatherInfoPanel::onResizeEvent(TpResizeEvent *event) override
暂无注释...
virtual TpString TpWeatherInfoPanel::pluginType() override
组件类名,子类实现,返回子类类名字符串,用于匹配CSS中对应...
组件类名,子类实现,返回子类类名字符串,用于匹配CSS中对应样式
返回值:类名字符串
