Added remove Avatar button

* Added remove Avatar button
This commit is contained in:
defnax 2022-04-05 16:39:28 +02:00
parent 958fac8e3c
commit 52d1e505ad
3 changed files with 34 additions and 0 deletions

View File

@ -88,6 +88,7 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
connect(ui->toolButton_Tag4, SIGNAL(clicked(bool)), this, SLOT(rmTag4()));
connect(ui->toolButton_Tag5, SIGNAL(clicked(bool)), this, SLOT(rmTag5()));
connect(ui->avatarButton, SIGNAL(clicked(bool)), this, SLOT(changeAvatar()));
connect(ui->removeButton, SIGNAL(clicked(bool)), this, SLOT(removeAvatar()));
connect(ui->avatarLabel,SIGNAL(cleared()),this,SLOT(avatarCleared()));
@ -102,6 +103,8 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
ui->plainTextEdit_Tag->hide();
ui->label_TagCheck->hide();
ui->frame_Tags->setHidden(true);
updateInterface();
}
IdEditDialog::~IdEditDialog() {}
@ -136,6 +139,8 @@ void IdEditDialog::changeAvatar()
// shows the tooltip for a while
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
updateInterface();
}
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
@ -353,6 +358,7 @@ void IdEditDialog::loadExistingId(const RsGxsIdGroup& id_group)
ui->frame_Tags->setHidden(true);
loadRecognTags();
updateInterface();
}
#define MAX_RECOGN_TAGS 5
@ -679,3 +685,22 @@ void IdEditDialog::updateId()
accept();
}
void IdEditDialog::removeAvatar()
{
ui->avatarLabel->setPicture(QPixmap());
mEditGroup.mImage.clear();
updateInterface();
}
void IdEditDialog::updateInterface()
{
const QPixmap *pixmap = ui->avatarLabel->pixmap();
if (pixmap && !pixmap->isNull()) {
ui->removeButton->setEnabled(true);
} else if (mEditGroup.mImage.mSize != NULL) {
ui->removeButton->setEnabled(true);
} else {
ui->removeButton->setEnabled(false);
}
}

View File

@ -54,6 +54,8 @@ private slots:
void avatarCleared();
void changeAvatar();
void removeAvatar();
void updateInterface();
void addRecognTag();
void checkNewTag();

View File

@ -369,6 +369,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<spacer name="avatarVSpacer">
<property name="orientation">