刷新部件
来源:互联网 发布:织梦cms手机端模板 编辑:程序博客网 时间:2024/04/28 18:07
Class TitleBar
{
Private:
Theme *_theme;
QLabel *_textLabel;
QPushButton *_button;
QString _text;
Public:
void TitleBar::setText(QString text)
{
_text = text;
}
void TitleBar::showEvent(QShowEvent *event)
{
if(_button->isVisible())
{
_textLabel->setFixedWidth(this->width()-_button->width()-MARGIN*3);
}
else
{
_textLabel->setFixedWidth(this->width()-MARGIN*2);
}
_textLabel->setText(_textLabel->fontMetrics().elidedText(_text, Qt::ElideRight, _textLabel->width(), Qt::TextSingleLine));
}
};
_titleBar->setText(location->getTitle());
问题:_titleBar->setText(location->getTitle());后titleBar上面的字符没有显示。
原因:setText方法只是把字符串赋值给了TitleBar的成员变量_text。要想显示必须调用_textLabel的setText方法。
方法:触发titleBar的showevent事件。 Titlebar->hide() Titlebar->show()
- 刷新部件
- android桌面小部件appwidget使用ListView或者StackView如何刷新
- 逻辑部件
- TOLEContainer部件
- JavaScript 部件
- 桌面部件
- 选择部件
- CDATA部件
- CDATA部件
- 小部件
- 数字部件
- 浮动部件
- axure部件
- 小部件
- 按钮部件
- 中心部件
- 刷新
- 刷新
- Flash Player渲染模型(显示列表)
- 实体 实体联系 数据库
- 时间测试程序===TMD的简单,高手请飘过
- Repeater与Table的配合使用
- Flex中自定义事件
- 刷新部件
- Bash 实例,第一部分
- Bash 实例,第 2 部分
- 书法视频推荐
- adb命令
- Memcached是什么?
- 软件项目管理随谈(4)——论项目主要阶段的重要性
- 用WPF实现在LISTVIEW中的鼠标悬停TOOLTIP显示
- Flash Player简单构成