QFtp and dataTransferProgress
Hi again! I'm having problems when i put files in the server with QFTP, the file is upload with no problem but when i want to show the transfer progress the signal datatransferprogress send a wrong value in the qint done... the first value that this signal send is 0 and the totalsize of the file and the second send the totalsize and the totasize... in 1 second this signal think that has send all the data when it is not like this.
Code:
void principal::loadFtp()
{
ftp->connectToHost(dirHost);
ftp->login(hostUser,hostPass);
ftp->cd("public_html");
ftp->list();
ftp
->setTransferMode
(QFtp::Active);
connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),this,SLOT(ftpProgress(qint64,qint64)));
connect(ftp,SIGNAL(stateChanged(int)),this,SLOT(ftpStateChanged(int)));
connect(ftp,SIGNAL(commandStarted(int)),this,SLOT(ftpStart(int)));
connect(ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(ftpFinish(int,bool)));
}
Code:
void principal::ftpProgress(qint64 done,qint64 total)
{
ui->ftpBar->setMaximum(total);
ui->ftpBar->setValue(done);
}
Re: QFtp and dataTransferProgress
The signal dataTransferProgress(qint64,qint64) emits when get() or put() is called. There are 2 overloads for a put() method. It seems that the signal is emitted only when int QFtp::put ( const QByteArray & data, const QString & file, TransferType type = Binary ) version is used. When the QIODevice* is used as a source, the documentation speaks only about emitting commandFinished() signal. If you are using QByteArray and it doesn't work, then I ran out of ideas for this moment, sorry.
Re: QFtp and dataTransferProgress
Code:
buffer = file.readAll();
buffer = buffer.toBase64();
file.close();
ftp
->put
(buffer,tempName,
QFtp::Binary);
I think im in problems because im calling a QByteArray... Now i will test what to do
I fyou have any other suggestion please let me know them
Thank for you answer