#ifndef QTHTTPS_H #define QTHTTPS_H #include #include #include #include #include class QtHttps : public QObject { Q_OBJECT public: explicit QtHttps(QObject *parent = nullptr); ~QtHttps(); bool Get(const QString &url); bool GetHead(const QString &url); void Post(const QString &url, const QByteArray &data); void downloadFile(const QString &url, const QString &filePath); private slots: void do_replyFinished(); void do_replyReadyRead(); void do_downloadProgress(qint64 bytesReceived, qint64 bytesTotal); private: QNetworkAccessManager *m_manager = nullptr; QNetworkReply *m_reply = nullptr; QFile *m_file = nullptr; /* 保存临时文件 */ }; #endif /* QTHTTPS_H */