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:
parent
8de71c19ed
commit
3cb1d280bc
|
@ -26,7 +26,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
FriendWidget::FriendWidget(int FriendId, QString id)
|
FriendWidget::FriendWidget(int FriendId, QString id)
|
||||||
: friendId(FriendId)
|
: friendId(FriendId), isDefaultAvatar{true}
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
|
@ -134,7 +134,8 @@ void FriendWidget::setAsActiveChatroom()
|
||||||
QPalette pal3;
|
QPalette pal3;
|
||||||
pal3.setColor(QPalette::Background, Qt::white);
|
pal3.setColor(QPalette::Background, Qt::white);
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
avatar.setPixmap(QPixmap(":img/contact_dark.png"));
|
if (isDefaultAvatar)
|
||||||
|
avatar.setPixmap(QPixmap(":img/contact_dark.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendWidget::setAsInactiveChatroom()
|
void FriendWidget::setAsInactiveChatroom()
|
||||||
|
@ -153,7 +154,9 @@ void FriendWidget::setAsInactiveChatroom()
|
||||||
QPalette pal3;
|
QPalette pal3;
|
||||||
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
|
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
avatar.setPixmap(QPixmap(":img/contact.png"));
|
|
||||||
|
if (isDefaultAvatar)
|
||||||
|
avatar.setPixmap(QPixmap(":img/contact.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendWidget::updateStatusLight()
|
void FriendWidget::updateStatusLight()
|
||||||
|
@ -196,5 +199,6 @@ void FriendWidget::onAvatarChange(int FriendId, const QPixmap& pic)
|
||||||
if (FriendId != friendId)
|
if (FriendId != friendId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
isDefaultAvatar = false;
|
||||||
avatar.setPixmap(pic);
|
avatar.setPixmap(pic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
int friendId;
|
int friendId;
|
||||||
QLabel avatar, statusPic;
|
QLabel avatar, statusPic;
|
||||||
CroppingLabel name, statusMessage;
|
CroppingLabel name, statusMessage;
|
||||||
|
bool isDefaultAvatar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRIENDWIDGET_H
|
#endif // FRIENDWIDGET_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user