April 2018
Beginner
714 pages
18h 21m
English
Until now, we have used the slot connected to the finished() signal to get the reply's content. This works perfectly if you are deal with small files. However, this approach is unsuitable when dealing with large files, as they will unnecessarily bind too many resources. For larger files, it is better to read and save the transferred data as soon as it is available. We are informed by QIODevice::readyRead() whenever new data is available to be read. So, for large files, you should use the following code:
QNetworkReply *reply = m_network_manager->get(request);connect(reply, &QIODevice::readyRead,
this, &SomeClass::readContent);
m_file.open(QIODevice::WriteOnly);
This will help you connect the reply's readyRead() signal ...
Read now
Unlock full access