has been completed.

This commit is contained in:
xyz
2025-09-09 15:37:57 +08:00
parent 83f3f4f74e
commit 89ff4fbac0
38 changed files with 2679 additions and 161 deletions

View File

@ -126,7 +126,7 @@ SessionFriendItem::SessionFriendItem(QWidget* owner, const QIcon& avatar, const
//添加到网格布局
layout->addWidget(avatarBtn, 0, 0, 2, 2);
layout->addWidget(nameLabel, 0, 2, 1, 25);
layout->addWidget(nameLabel, 0, 2, 1, 20);
layout->addWidget(messageLabel, 1, 2, 1, 25);
}
@ -390,16 +390,35 @@ ApplyItem::ApplyItem(QWidget *owner, const QString &userId, const QIcon &avatar,
//创建两个按钮
QPushButton* acceptBtn = new QPushButton();
acceptBtn->setStyleSheet("QPushButton {color: rgb(0, 0, 0); } ");
acceptBtn->setStyleSheet("QPushButton {color: rgb(255, 255, 255); background-color: rgb(7, 193, 96); border: none; border-radius: 5px; } ");
acceptBtn->setText("同意");
acceptBtn->setFixedSize(40, 20);
QPushButton* rejectBtn = new QPushButton();
rejectBtn->setStyleSheet("QPushButton {color: rgb(0, 0, 0); } ");
rejectBtn->setStyleSheet("QPushButton {color: rgb(250, 81, 81); background-color: rgb(190, 190, 190); border: none; border-radius: 5px; } ");
rejectBtn->setText("拒绝");
rejectBtn->setFixedSize(40, 20);
//添加到布局管理器中
layout->addWidget(acceptBtn, 1, 2, 1, 3);
layout->addWidget(rejectBtn, 1, 5, 1, 3);
layout->addWidget(acceptBtn, 1, 2, 1, 4);
layout->addWidget(rejectBtn, 1, 6, 1, 4);
//添加信号槽
connect(acceptBtn, &QPushButton::clicked, this, &ApplyItem::acceptFriendApply);
connect(rejectBtn, &QPushButton::clicked, this, &ApplyItem::rejectFriendApply);
}
void ApplyItem::acceptFriendApply()
{
//发送网络请求,告知服务器,同意了好友的申请
DataCenter* dataCenter = DataCenter::getInstance();
//看同意了谁的好友申请
dataCenter->acceptFriendApplyAsync(this->userId);
}
void ApplyItem::rejectFriendApply()
{
DataCenter* dataCenter = DataCenter::getInstance();
dataCenter->rejectFriendApplyAsync(this->userId);
}
void ApplyItem::active()