1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix avatars resetting after friend clicked on

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-09-24 17:35:24 +02:00
parent 8de71c19ed
commit 3cb1d280bc
2 changed files with 8 additions and 3 deletions

View File

@ -26,7 +26,7 @@
#include <QMenu>
FriendWidget::FriendWidget(int FriendId, QString id)
: friendId(FriendId)
: friendId(FriendId), isDefaultAvatar{true}
{
setMouseTracking(true);
setAutoFillBackground(true);
@ -134,7 +134,8 @@ void FriendWidget::setAsActiveChatroom()
QPalette pal3;
pal3.setColor(QPalette::Background, Qt::white);
this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/contact_dark.png"));
if (isDefaultAvatar)
avatar.setPixmap(QPixmap(":img/contact_dark.png"));
}
void FriendWidget::setAsInactiveChatroom()
@ -153,7 +154,9 @@ void FriendWidget::setAsInactiveChatroom()
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/contact.png"));
if (isDefaultAvatar)
avatar.setPixmap(QPixmap(":img/contact.png"));
}
void FriendWidget::updateStatusLight()
@ -196,5 +199,6 @@ void FriendWidget::onAvatarChange(int FriendId, const QPixmap& pic)
if (FriendId != friendId)
return;
isDefaultAvatar = false;
avatar.setPixmap(pic);
}

View File

@ -48,6 +48,7 @@ public:
int friendId;
QLabel avatar, statusPic;
CroppingLabel name, statusMessage;
bool isDefaultAvatar;
};
#endif // FRIENDWIDGET_H