-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweather.h
59 lines (48 loc) · 1.14 KB
/
weather.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
#ifndef WEATHER_H
#define WEATHER_H
/*
* 显示天气
*/
#include <QWidget>
#include <QNetworkAccessManager>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QNetworkReply>
#include <QTimer>
#include "changcity.h"
class Weather : public QWidget
{
Q_OBJECT
public:
explicit Weather(QWidget *parent = 0);
private:
QNetworkAccessManager * mNetwoekAccessManager;
QString getCityId(QString cityName) ;
QStringList getCityList() ;
void getWeatherIcon(QString weather);
QStringList mCityList;
QString mCurrentCity;
QString getCity();
QMap<QString,QString> mCityToCityId;
QString getAPIUrl(QString city);
QTimer * timer;
ChangCity * mChangeCity;
QLabel * uWeatherIcon;
QLabel * uWeatherText;
QLabel * uWeatherTemperature;
void InitUi();
signals:
private slots:
void replyFinished(QNetworkReply*);
public slots:
void reflashWeather();
void setCurrentCity(QString city);
protected:
void contextMenuEvent(QContextMenuEvent *event);
};
#endif // WEATHER_H