monillo
14th May 2015, 13:16
Hello everybody:
In a small app that download a file from a url, I have this code:
MyClasse.h
...
...
private slots:
void downloadProgressShow(quint64 bytesRead, quint64 bytesTotal);
...
...
myclasse.cpp
...
...
void MyClasse::on_btnDownload_clicked()
{
...
QNetworkAccessManager *manager = new QNetworkAccessMananger(this);
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("http://www .....")));
// --- Show the progress.
connect(reply,SIGNAL(downloadProgress(qint64,qint6 4)),this,SLOT(downloadProgressShow(qint64,quint64) ));
// --- When download finished, save the file.
connect(manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(saveFileDownloaded(QNetworkReply *)));
}
void MyClasse::downloadProgressShow(qint64 bytesRead, quint64 bytesTotal)
{
qDebug() << QString::number(bytesRead).toLatin1() + " bytes of " + QString::number(bytesTotal).toLatin1();
}
The file download is correctly, but the progressbar is not refreshed. The application output of Qt Creator say:
QObject::connect: Incompatible sender/receiver arguments
QNetworkReplyHttpImpl::downloadProgress(qint64,qin t64) --> Classe::downloadProgressShow(qint64,quint64)
But really the functions of SIGNAL and SLOT are the same arguments, or not?
Thanks in advance.
In a small app that download a file from a url, I have this code:
MyClasse.h
...
...
private slots:
void downloadProgressShow(quint64 bytesRead, quint64 bytesTotal);
...
...
myclasse.cpp
...
...
void MyClasse::on_btnDownload_clicked()
{
...
QNetworkAccessManager *manager = new QNetworkAccessMananger(this);
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("http://www .....")));
// --- Show the progress.
connect(reply,SIGNAL(downloadProgress(qint64,qint6 4)),this,SLOT(downloadProgressShow(qint64,quint64) ));
// --- When download finished, save the file.
connect(manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(saveFileDownloaded(QNetworkReply *)));
}
void MyClasse::downloadProgressShow(qint64 bytesRead, quint64 bytesTotal)
{
qDebug() << QString::number(bytesRead).toLatin1() + " bytes of " + QString::number(bytesTotal).toLatin1();
}
The file download is correctly, but the progressbar is not refreshed. The application output of Qt Creator say:
QObject::connect: Incompatible sender/receiver arguments
QNetworkReplyHttpImpl::downloadProgress(qint64,qin t64) --> Classe::downloadProgressShow(qint64,quint64)
But really the functions of SIGNAL and SLOT are the same arguments, or not?
Thanks in advance.