diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index 60b0dc84b..faac2fa01 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -217,7 +217,8 @@ void AddFriendForm::setIdFromClipboard() void AddFriendForm::onFriendRequestAccepted() { - QWidget* friendWidget = static_cast(sender()); + QPushButton* acceptButton = static_cast(sender()); + QWidget* friendWidget = acceptButton->parentWidget(); int index = requestsLayout->indexOf(friendWidget); friendWidget->deleteLater(); requestsLayout->removeWidget(friendWidget); @@ -228,7 +229,8 @@ void AddFriendForm::onFriendRequestAccepted() void AddFriendForm::onFriendRequestRejected() { - QWidget* friendWidget = static_cast(sender()); + QPushButton* rejectButton = static_cast(sender()); + QWidget* friendWidget = rejectButton->parentWidget(); int index = requestsLayout->indexOf(friendWidget); friendWidget->deleteLater(); requestsLayout->removeWidget(friendWidget); @@ -285,13 +287,13 @@ void AddFriendForm::addFriendRequestWidget(const QString &friendAddress, const Q QPushButton* acceptButton = new QPushButton(friendWidget); acceptButtons.insert(acceptButton); - connect(acceptButton, &QPushButton::released, this, &AddFriendForm::onFriendRequestAccepted); + connect(acceptButton, &QPushButton::clicked, this, &AddFriendForm::onFriendRequestAccepted); friendLayout->addWidget(acceptButton); retranslateAcceptButton(acceptButton); QPushButton* rejectButton = new QPushButton(friendWidget); - acceptButtons.insert(acceptButton); - connect(acceptButton, &QPushButton::released, this, &AddFriendForm::onFriendRequestAccepted); + acceptButtons.insert(rejectButton); + connect(rejectButton, &QPushButton::clicked, this, &AddFriendForm::onFriendRequestRejected); friendLayout->addWidget(rejectButton); retranslateRejectButton(rejectButton); diff --git a/src/widget/form/groupinviteform.cpp b/src/widget/form/groupinviteform.cpp index 8a4b1469d..51cdc62ef 100644 --- a/src/widget/form/groupinviteform.cpp +++ b/src/widget/form/groupinviteform.cpp @@ -67,7 +67,7 @@ GroupInviteForm::GroupInviteForm() void GroupInviteForm::show(ContentLayout* contentLayout) { contentLayout->mainContent->layout()->addWidget(this); - //contentLayout->mainHead->layout()->addWidget(head); + contentLayout->mainHead->layout()->addWidget(headWidget); QWidget::show(); headWidget->show(); } @@ -83,13 +83,13 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray QPushButton* acceptButton = new QPushButton(this); acceptButtons.insert(acceptButton); - connect(acceptButton, &QPushButton::released, this, &GroupInviteForm::onGroupInviteAccepted); + connect(acceptButton, &QPushButton::clicked, this, &GroupInviteForm::onGroupInviteAccepted); groupLayout->addWidget(acceptButton); retranslateAcceptButton(acceptButton); QPushButton* rejectButton = new QPushButton(this); rejectButtons.insert(rejectButton); - connect(rejectButton, &QPushButton::released, this, &GroupInviteForm::onGroupInviteRejected); + connect(rejectButton, &QPushButton::clicked, this, &GroupInviteForm::onGroupInviteRejected); groupLayout->addWidget(rejectButton); retranslateRejectButton(rejectButton); @@ -113,7 +113,8 @@ void GroupInviteForm::showEvent(QShowEvent* event) void GroupInviteForm::onGroupInviteAccepted() { - QWidget* groupWidget = static_cast(sender()); + QPushButton* acceptButton = static_cast(sender()); + QWidget* groupWidget = acceptButton->parentWidget(); int index = inviteLayout->indexOf(groupWidget); GroupInvite invite = groupInvites.at(index); groupInvites.removeAt(index); @@ -126,7 +127,8 @@ void GroupInviteForm::onGroupInviteAccepted() void GroupInviteForm::onGroupInviteRejected() { - QWidget* groupWidget = static_cast(sender()); + QPushButton* rejectButton = static_cast(sender()); + QWidget* groupWidget = rejectButton->parentWidget(); int index = inviteLayout->indexOf(groupWidget); groupInvites.removeAt(index);