From 1d5396d50916747ae811bda1b815e662a2ba4c10 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 10 Feb 2021 23:29:33 +0100 Subject: [PATCH] Fixed Avatar storing on Avatar Dialog --- retroshare-gui/src/gui/FriendsDialog.ui | 12 +++++++++--- retroshare-gui/src/gui/common/AvatarDialog.cpp | 6 +++--- retroshare-gui/src/gui/common/AvatarDialog.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/FriendsDialog.ui b/retroshare-gui/src/gui/FriendsDialog.ui index bc74a7634..b32c71465 100644 --- a/retroshare-gui/src/gui/FriendsDialog.ui +++ b/retroshare-gui/src/gui/FriendsDialog.ui @@ -151,8 +151,14 @@ 0 + + + 96 + 96 + + - false + true @@ -171,7 +177,7 @@ - + :/images/edit_16.png:/images/edit_16.png @@ -264,7 +270,7 @@ - + :/images/add_image24.png:/images/add_image24.png diff --git a/retroshare-gui/src/gui/common/AvatarDialog.cpp b/retroshare-gui/src/gui/common/AvatarDialog.cpp index 16b832345..8eb24a184 100644 --- a/retroshare-gui/src/gui/common/AvatarDialog.cpp +++ b/retroshare-gui/src/gui/common/AvatarDialog.cpp @@ -132,7 +132,7 @@ void AvatarDialog::getAvatar(QPixmap &avatar) void AvatarDialog::getAvatar(QByteArray &avatar) { - const QPixmap *pixmap = ui->avatarLabel->pixmap(); + pixmap = ui->avatarLabel->extractCroppedScaledPicture(); if (!pixmap) { avatar.clear(); return; @@ -141,7 +141,7 @@ void AvatarDialog::getAvatar(QByteArray &avatar) QBuffer buffer(&avatar); buffer.open(QIODevice::WriteOnly); - pixmap->save(&buffer, "PNG"); // writes image into ba in PNG format + pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format } void AvatarDialog::load() @@ -331,6 +331,6 @@ void AvatarDialog::addAvatar() QString sticker = qobject_cast(sender())->statusTip(); QPixmap pixmap(sticker); - ui->avatarLabel->setPixmap(pixmap); + ui->avatarLabel->setPicture(pixmap); updateInterface(); } diff --git a/retroshare-gui/src/gui/common/AvatarDialog.h b/retroshare-gui/src/gui/common/AvatarDialog.h index 7144c11ad..f324fb86d 100644 --- a/retroshare-gui/src/gui/common/AvatarDialog.h +++ b/retroshare-gui/src/gui/common/AvatarDialog.h @@ -62,6 +62,7 @@ private slots: private: void updateInterface(); + QPixmap pixmap; private: Ui::AvatarDialog *ui;