Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkReply and file downloading problem
Forum Updated to NodeBB v4.3 + New Features

QNetworkReply and file downloading problem

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 763 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kaluss
    wrote on last edited by
    #1

    Hello,
    I experience a strange situation:
    @this->connect( this->networkManager, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onDownloadingFinished( QNetworkReply* ) ) );

    void UpdateMgr::onDownloadingFinished( QNetworkReply* reply )
    {
    if( reply->error() == QNetworkReply::NoError )
    {
    qDebug() << "Size of downloaded file:" << reply->size();
    qDebug() << "Size of saved file:" << reply->readAll().length();
    }
    @
    Output:
    Size of downloaded file: 11902976
    Size of saved file: 11894784

    Casue of that I det damaged file. Why????

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msue
      wrote on last edited by
      #2

      You have to append reply->readAll to your file on each readyRead signal and close your file when the finish signal comes as it may not come all in one big chunk.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved