mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-13 16:41:48 +08:00
update layout code
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
|
||||
SessionFriendArea::SessionFriendArea(QWidget *parent)
|
||||
: QScrollArea {parent}
|
||||
@ -34,7 +36,14 @@ SessionFriendArea::SessionFriendArea(QWidget *parent)
|
||||
// }
|
||||
}
|
||||
|
||||
SessionFriendItem::SessionFriendItem(QWidget *owner, const QIcon *avatar, const QString *name, const QString &text)
|
||||
void SessionFriendArea::clear()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SessionFriendArea::addItem(const QIcon &avatar, const QString &name, const QString &text)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -15,6 +15,14 @@ class SessionFriendArea : public QScrollArea
|
||||
public:
|
||||
explicit SessionFriendArea(QWidget *parent = nullptr);
|
||||
|
||||
//清空区域内所有的Item
|
||||
void clear();
|
||||
|
||||
//添加一个Item
|
||||
void addItem(const QIcon& avatar, const QString& name, const QString& text);
|
||||
|
||||
//
|
||||
|
||||
private:
|
||||
//后续向container中的layout添加元素,就会有QScrollArea的滚动
|
||||
QWidget* container;
|
||||
@ -32,13 +40,13 @@ class SessionFriendItem : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SessionFriendItem(QWidget* owner, const QIcon* avatar, const QString* name, const QString& text);
|
||||
SessionFriendItem(QWidget* owner, const QIcon& avatar, const QString& name, const QString& text);
|
||||
|
||||
private:
|
||||
//owner 就是指向了 SessionFriendArea
|
||||
QWidget* owner;
|
||||
|
||||
//表示当前的Item是否是选中的状态
|
||||
//表示当前的Item是否是选中的状态(选中时其背景色会有所不同)
|
||||
bool selected = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user