Try to reduce memory usage by reusing avatar pixmaps
This commit is contained in:
parent
89015b9f18
commit
52056a79fa
27 changed files with 149 additions and 208 deletions
|
|
@ -52,10 +52,9 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||
textLayout_->setSpacing(widgetMargin / 2);
|
||||
textLayout_->setContentsMargins(widgetMargin * 2, widgetMargin, widgetMargin, widgetMargin);
|
||||
|
||||
userAvatar_ = new Avatar(this);
|
||||
userAvatar_ = new Avatar(this, fontHeight * 2.5);
|
||||
userAvatar_->setObjectName("userAvatar");
|
||||
userAvatar_->setLetter(QChar('?'));
|
||||
userAvatar_->setSize(fontHeight * 2.5);
|
||||
|
||||
QFont nameFont;
|
||||
nameFont.setPointSizeF(nameFont.pointSizeF() * 1.1);
|
||||
|
|
@ -134,14 +133,6 @@ UserInfoWidget::reset()
|
|||
userAvatar_->setLetter(QChar('?'));
|
||||
}
|
||||
|
||||
void
|
||||
UserInfoWidget::setAvatar(const QImage &img)
|
||||
{
|
||||
avatar_image_ = img;
|
||||
userAvatar_->setImage(img);
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
UserInfoWidget::setDisplayName(const QString &name)
|
||||
{
|
||||
|
|
@ -160,6 +151,14 @@ UserInfoWidget::setUserId(const QString &userid)
|
|||
{
|
||||
user_id_ = userid;
|
||||
userIdLabel_->setText(userid);
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
UserInfoWidget::setAvatar(const QString &url)
|
||||
{
|
||||
userAvatar_->setImage(url);
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue