mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
Write the layout
This commit is contained in:
46
sessionfriendarea.h
Normal file
46
sessionfriendarea.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef SESSIONFRIENDAREA_H
|
||||
#define SESSIONFRIENDAREA_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScrollArea>
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
/// 整个滚动区域的实现
|
||||
////////////////////////////////////////
|
||||
|
||||
class SessionFriendArea : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SessionFriendArea(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
//后续向container中的layout添加元素,就会有QScrollArea的滚动
|
||||
QWidget* container;
|
||||
|
||||
signals:
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
/// 滚动区域的Item的实现
|
||||
////////////////////////////////////////
|
||||
|
||||
class SessionFriendItem : public QWidget {
|
||||
//可以使当前的类使用信号与槽相关的操作
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SessionFriendItem(QWidget* owner, const QIcon* avatar, const QString* name, const QString& text);
|
||||
|
||||
private:
|
||||
//owner 就是指向了 SessionFriendArea
|
||||
QWidget* owner;
|
||||
|
||||
//表示当前的Item是否是选中的状态
|
||||
bool selected = false;
|
||||
};
|
||||
|
||||
|
||||
#endif // SESSIONFRIENDAREA_H
|
||||
Reference in New Issue
Block a user