Merge pull request #1211 from PhenomRetroShare/Fix_AvatarStatusOverlay

Fix Friend Avatar status overlay no depends size scale.
This commit is contained in:
csoler 2018-03-14 20:56:30 +01:00 committed by GitHub
commit 6e8305abda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -496,22 +496,21 @@ void FriendList::groupsChanged()
static QIcon createAvatar(const QPixmap &avatar, const QPixmap &overlay)
{
int avatarWidth = avatar.width();
int avatarHeight = avatar.height();
int avatarWidth = avatar.width();
int avatarHeight = avatar.height();
QPixmap pixmap(avatar);
QPixmap pixmap(avatar);
int overlayWidth = avatarWidth / 2.5;
int overlayHeight = avatarHeight / 2.5;
int overlayX = avatarWidth - overlayWidth;
int overlayY = avatarHeight - overlayHeight;
int overlaySize = (avatarWidth > avatarHeight) ? (avatarWidth/2.5) : (avatarHeight/2.5);
int overlayX = avatarWidth - overlaySize;
int overlayY = avatarHeight - overlaySize;
QPainter painter(&pixmap);
painter.drawPixmap(overlayX, overlayY, overlayWidth, overlayHeight, overlay);
QPainter painter(&pixmap);
painter.drawPixmap(overlayX, overlayY, overlaySize, overlaySize, overlay);
QIcon icon;
icon.addPixmap(pixmap);
return icon;
QIcon icon;
icon.addPixmap(pixmap);
return icon;
}
static void getNameWidget(QTreeWidget *treeWidget, QTreeWidgetItem *item, ElidedLabel *&nameLabel, ElidedLabel *&textLabel)