mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-06-21 21:58:47 +08:00
add choose friend to group chats
This commit is contained in:
55
choosefrienddialog.h
Normal file
55
choosefrienddialog.h
Normal file
@ -0,0 +1,55 @@
|
||||
#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 QIcon& avatar, const QString& name, bool checked);
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void enterEvent(QEnterEvent* event) override;
|
||||
void leaveEvent(QEvent* event) override;
|
||||
|
||||
private:
|
||||
bool isHover = false;
|
||||
|
||||
QCheckBox* checkBox;
|
||||
QPushButton* avatarBtn;
|
||||
QLabel* nameLabel;
|
||||
ChooseFriendDialog* owner; //记录了哪个QWidget持有这个Item,此处应该是ChooseFriendDialog
|
||||
};
|
||||
|
||||
class ChooseFriendDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChooseFriendDialog(QWidget *parent);
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
QWidget* totalContainer;
|
||||
QWidget* selectedContainer;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user