-
Notifications
You must be signed in to change notification settings - Fork 7
/
asiawea.h
81 lines (65 loc) · 1.74 KB
/
asiawea.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef ASIAWEA_H
#define ASIAWEA_H
#include <QMainWindow>
#include <QMap>
#include <QLabel>
#include "weatherData.h"
#include "worldlistwea.h"
#include<QNetworkAccessManager>
#include<QNetworkReply>
QT_BEGIN_NAMESPACE
namespace Ui {
class AsiaWea;
}
QT_END_NAMESPACE
class AsiaWea : public QMainWindow
{
Q_OBJECT
public:
explicit AsiaWea(QWidget *parent = nullptr);
~AsiaWea();
//得到返回值按钮
WorldListWea* ListBtn = new WorldListWea;
QString errmsg;
protected:
void contextMenuEvent(QContextMenuEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
//获取天气数据、解析Json、更新UI
void getWeatherInfo(QString cityName);
void parseJson(QByteArray& byteArray);
void updateUI();
//重写父类的eventFilter方法
bool eventFilter(QObject* watched,QEvent* event);
void paintHighCurve();
void paintLowCurve();
void weaTypeIcon();
private slots:
void GetData(QString);
signals:
void MainBtn();
void sendTemp(QString temp,QString city,QString type);
private:
void onReplied(QNetworkReply* reply);
private:
Ui::AsiaWea *ui;
QMenu* mExitMenu; // 退出菜单
QAction* mExitAct; // 菜单项(退出)
QPoint mOffset; //窗口移动时,鼠标与左上角的偏移
QNetworkAccessManager* mNetAccessManager;
Today mToday;
Day mDay[6];
//星期和日期
QList<QLabel*> mWeekList;
QList<QLabel*> mDateList;
//天气和图标
QList<QLabel*> mTypeList;
QList<QLabel*> mTypeIconList;
// 质量指数
QList<QLabel*> mAqiList;
//风力风向
QList<QLabel*> mFxList;
QList<QLabel*> mFlList;
QMap<QString,QString>mTypeMap;
};
#endif // ASIAWEA_H