0

每当我使用如下所示的 FileDownloader 下载图像时,我都会收到以下警告:

QSslSocket:无法解析 TLSv1_1_client_method

QSslSocket:无法解析 TLSv1_2_client_method

QSslSocket:无法解析 TLSv1_1_server_method

QSslSocket:无法解析 TLSv1_2_server_method

QSslSocket:无法解析 SSL_select_next_proto

QSslSocket:无法解析 SSL_CTX_set_next_proto_select_cb

QSslSocket:无法解析 SSL_get0_next_proto_negotiated

这发生在我从例如http://www.google.co.uk/images/srpr/logo11w.png获取图像的任何 url

我的代码中是否存在导致这些警告的内容?:

文件下载器.h:

#ifndef FILEDOWNLOADER_H
#define FILEDOWNLOADER_H

#include <QObject>
#include <QByteArray>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>

class FileDownloader : public QObject
{
    Q_OBJECT
public:
    explicit FileDownloader(QUrl imageUrl, QObject *parent = 0);

    virtual ~FileDownloader();

    QByteArray downloadedData() const;



signals:
        void downloaded();
        float downloadedPercent(float percent);

private slots:

    void fileDownloaded();
   void  getDownloadData(qint64 read, qint64 total);

private:

    QNetworkAccessManager m_WebCtrl;
    QByteArray m_DownloadedData;
    QNetworkReply* reply;
    unsigned int inc;

};

#endif // FILEDOWNLOADER_H

文件下载器.cpp:

#include "filedownloader.h"

FileDownloader::FileDownloader(QUrl imageUrl, QObject *parent) :
    QObject(parent)
{
    QNetworkRequest request(imageUrl);
    reply = m_WebCtrl.get(request);

    connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(getDownloadData(qint64, qint64)) );

    connect(reply, SIGNAL(finished()),this, SLOT(fileDownloaded()));

    inc=1;

}

FileDownloader::~FileDownloader()
{

}

void FileDownloader::fileDownloaded()
{
    m_DownloadedData = reply->readAll();
    //emit a signal
    reply->deleteLater();
    emit downloaded();
}

QByteArray FileDownloader::downloadedData() const
{
    return m_DownloadedData;
}

 void FileDownloader::getDownloadData(qint64 read, qint64 total)
 {
float readf = read;
float totalf=total;
float hund = 100;
     float percent = (readf / totalf) * hund;
     emit downloadedPercent(percent);


 }
4

0 回答 0