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