mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
Merge pull request #2310 from defnax/avatardialog-fix-v2
Fixed Avatar storing on Avatar Dialog
This commit is contained in:
commit
8e0e4eb138
@ -151,8 +151,14 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>96</width>
|
||||||
|
<height>96</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="scaledContents">
|
<property name="scaledContents">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -171,7 +177,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/edit_16.png</normaloff>:/images/edit_16.png</iconset>
|
<normaloff>:/images/edit_16.png</normaloff>:/images/edit_16.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolButtonStyle">
|
<property name="toolButtonStyle">
|
||||||
@ -264,7 +270,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionSet_your_Avatar">
|
<action name="actionSet_your_Avatar">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="images.qrc">
|
<iconset>
|
||||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -132,7 +132,7 @@ void AvatarDialog::getAvatar(QPixmap &avatar)
|
|||||||
|
|
||||||
void AvatarDialog::getAvatar(QByteArray &avatar)
|
void AvatarDialog::getAvatar(QByteArray &avatar)
|
||||||
{
|
{
|
||||||
const QPixmap *pixmap = ui->avatarLabel->pixmap();
|
pixmap = ui->avatarLabel->extractCroppedScaledPicture();
|
||||||
if (!pixmap) {
|
if (!pixmap) {
|
||||||
avatar.clear();
|
avatar.clear();
|
||||||
return;
|
return;
|
||||||
@ -141,7 +141,7 @@ void AvatarDialog::getAvatar(QByteArray &avatar)
|
|||||||
QBuffer buffer(&avatar);
|
QBuffer buffer(&avatar);
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
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()
|
void AvatarDialog::load()
|
||||||
@ -331,6 +331,6 @@ void AvatarDialog::addAvatar()
|
|||||||
QString sticker = qobject_cast<QPushButton*>(sender())->statusTip();
|
QString sticker = qobject_cast<QPushButton*>(sender())->statusTip();
|
||||||
QPixmap pixmap(sticker);
|
QPixmap pixmap(sticker);
|
||||||
|
|
||||||
ui->avatarLabel->setPixmap(pixmap);
|
ui->avatarLabel->setPicture(pixmap);
|
||||||
updateInterface();
|
updateInterface();
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateInterface();
|
void updateInterface();
|
||||||
|
QPixmap pixmap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AvatarDialog *ui;
|
Ui::AvatarDialog *ui;
|
||||||
|
Loading…
Reference in New Issue
Block a user