-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChatBox.h
51 lines (44 loc) · 920 Bytes
/
ChatBox.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef CHATBOX_H
#define CHATBOX_H
#include "Defines.h"
struct ChatMsg{
int life;
string msg;
ChatMsg();
ChatMsg(string message,int msgLife);
};
namespace Ui {
class ChatBox;
}
class ChatBox : public QDialog
{
Q_OBJECT
public:
explicit ChatBox(QWidget *parent = 0);
~ChatBox();
public:
void Say(string &text,int time);
void Update();
private:
void UpdateChatBox();
void UpdateChatBoxDis();
int GetStrWidth(const string& str);
void paintEvent(QPaintEvent *);
private slots:
void timerUpDate();
private:
Ui::ChatBox *ui;
QPixmap chatBoxPic[3];
//聊天窗口
int boxLife;
string boxText;
bool cancover;//可覆盖
queue<ChatMsg> msgQueue;//消息队列
const int widthPerLine = 172;
const int font_size = 28;
int boxH;
int lines;
//vector<char*> cstrList;
vector<string> strList;
};
#endif // CHATBOX_H