mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
add addFriendDialog and promote others
This commit is contained in:
@ -20,12 +20,20 @@ class ChooseFriendDialog;
|
||||
class ChooseFriendItem : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChooseFriendItem(ChooseFriendDialog* owner, const QIcon& avatar, const QString& name, bool checked);
|
||||
ChooseFriendItem(ChooseFriendDialog* owner, const QString& userId, const QIcon& avatar, const QString& name, bool checked);
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void enterEvent(QEnterEvent* event) override;
|
||||
void leaveEvent(QEvent* event) override;
|
||||
|
||||
QString& getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
QCheckBox* getCheckBox() {
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
private:
|
||||
bool isHover = false;
|
||||
|
||||
@ -33,6 +41,8 @@ private:
|
||||
QPushButton* avatarBtn;
|
||||
QLabel* nameLabel;
|
||||
ChooseFriendDialog* owner; //记录了哪个QWidget持有这个Item,此处应该是ChooseFriendDialog
|
||||
|
||||
QString userId; //记录成员id用于删除唯一指定的成员Item
|
||||
};
|
||||
|
||||
class ChooseFriendDialog : public QDialog
|
||||
@ -45,8 +55,9 @@ public:
|
||||
void initLeft(QHBoxLayout* layout);
|
||||
void initRight(QHBoxLayout* layout);
|
||||
|
||||
void addFriend(const QIcon& avatar, const QString& name, bool checked);
|
||||
void addSelectedFriend(const QIcon& avatar, const QString& name);
|
||||
void addFriend(const QString& userId, const QIcon& avatar, const QString& name, bool checked);
|
||||
void addSelectedFriend(const QString& userId, const QIcon& avatar, const QString& name);
|
||||
void deleteSelectedFriend(const QString& userId);
|
||||
|
||||
private:
|
||||
QWidget* totalContainer;
|
||||
|
||||
Reference in New Issue
Block a user