Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

A gap between QNetworkReply::finished signal and QNetworkReply::uploadProgress



  • Hi, I'm presenting a progress dialog while uploading content to the server,
    but I stop recieving the QNetworkReply::uploadProgress signal a few seconds before I recieve the QNetworkReply::finished signal.
    Why is that? here is my code:

    QHttpMultiPart* pUploadData = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
    QFile* pFile = new QFile(fileName);
    pFile->open(QIODevice::ReadOnly);
    QHttpPart jsonPart;
    jsonPart.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
    jsonPart.setHeader(QNetworkRequest::ContentDispositionHeader, QStringLiteral("form-data; name=\"%1\"").arg(fileName);
    jsonPart.setBodyDevice(pFile);
    pFile->setParent(pUploadData);
    pUploadData->append(jsonPart);
    m_netRequest.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\""));
    m_netRequest.setRawHeader(QLatin1Literal("Accept").data(), QLatin1Literal("text/plain").data());
    m_netRequest.setUrl(url);
    m_pUploadReply = m_netManager.post(m_netRequest, pUploadData);
    connect(&m_netManager, &QNetworkAccessManager::finished, this, &FeedbackConnectionManager::OnUploadFinished);
    connect(m_pUploadReply, &QNetworkReply::uploadProgress, m_pProgress, &ProgressDialog::networkUploadProgress);

  • Lifetime Qt Champion

    Hi,

    What is the size of the data ?

    Did you check with a tool like WireShark whether there was still network activities after the progress update stops ?


Log in to reply