mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
refactor: 大规模调整项目目录结构,将ChatClient和ChatServer整合为Monorepo结构,并分为两个独立文件夹:chatclient/ 和 chatserver/。更新了ChatClient的CMakeLists.txt配置以适配新结构。
This commit is contained in:
72
ChatClient/include/choosefrienddialog.h
Normal file
72
ChatClient/include/choosefrienddialog.h
Normal file
@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QScrollBar>
|
||||
#include <QPushButton>
|
||||
#include <QPainter>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
class ChooseFriendDialog;
|
||||
|
||||
////////////////////////////////////////////////
|
||||
/// 选择好友窗口中的一个 元素/好友项
|
||||
////////////////////////////////////////////////
|
||||
class ChooseFriendItem : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
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;
|
||||
|
||||
QCheckBox* checkBox;
|
||||
QPushButton* avatarBtn;
|
||||
QLabel* nameLabel;
|
||||
ChooseFriendDialog* owner; //记录了哪个QWidget持有这个Item,此处应该是ChooseFriendDialog
|
||||
|
||||
QString userId; //记录成员id用于删除唯一指定的成员Item
|
||||
};
|
||||
|
||||
class ChooseFriendDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChooseFriendDialog(QWidget *parent, const QString& userId);
|
||||
|
||||
void initLeft(QHBoxLayout* layout);
|
||||
void initRight(QHBoxLayout* layout);
|
||||
void initData();
|
||||
|
||||
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);
|
||||
|
||||
void clickOkBtn();
|
||||
QList<QString> generateMemberList();
|
||||
private:
|
||||
QWidget* totalContainer;
|
||||
QWidget* selectedContainer;
|
||||
|
||||
//当前选择窗口是点击哪个用户弹出的
|
||||
QString userId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user