Files
MyChat_Client/messageshowarea.h
2025-05-25 19:09:54 +08:00

46 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef MESSAGESHOWAREA_H
#define MESSAGESHOWAREA_H
#include <QScrollArea>
#include <QWidget>
#include <QVBoxLayout>
#include <QScrollBar>
#include <QPushButton>
#include <QLabel>
#include "model/data.h"
//.h文件中不宜使用namespace xxx
using model::Message;
////////////////////////////////////////////
/// 表示消息展示区
////////////////////////////////////////////
class MessageShowArea : public QScrollArea
{
Q_OBJECT
public:
MessageShowArea();
private:
QWidget* container;
};
////////////////////////////////////////////
/// 表示一个消息元素
/// 我们可能考虑要同时支持文本,文件,图片,视频,语音
////////////////////////////////////////////
class MessageItem : public QWidget {
public:
//isLeft表示当前的这个消息是否是左侧的消息
MessageItem(bool isLeft);
//通过工厂方法创建MessageItem实例
static MessageItem* makeMessageItem(bool isLeft, const Message& message);
private:
bool isLeft;
};
#endif // MESSAGESHOWAREA_H