Results 1 to 3 of 3

Thread: QFtp and dataTransferProgress

  1. #1

    Default 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.

    Qt Code:
    1. void principal::loadFtp()
    2. {
    3. ftp = new QFtp;
    4. ftp->connectToHost(dirHost);
    5. ftp->login(hostUser,hostPass);
    6. ftp->cd("public_html");
    7. ftp->list();
    8. ftp->setTransferMode(QFtp::Active);
    9.  
    10. connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),this,SLOT(ftpProgress(qint64,qint64)));
    11. connect(ftp,SIGNAL(stateChanged(int)),this,SLOT(ftpStateChanged(int)));
    12. connect(ftp,SIGNAL(commandStarted(int)),this,SLOT(ftpStart(int)));
    13. connect(ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(ftpFinish(int,bool)));
    14. connect(ftp,SIGNAL(listInfo(QUrlInfo)),this,SLOT(showList(QUrlInfo)));
    15. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void principal::ftpProgress(qint64 done,qint64 total)
    2. {
    3. ui->ftpBar->setMaximum(total);
    4. ui->ftpBar->setValue(done);
    5. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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:ut ( 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.

  3. #3

    Default Re: QFtp and dataTransferProgress

    Qt Code:
    1. QByteArray buffer;
    2.  
    3. QFile file(fileName);
    4. file.open(QIODevice::ReadOnly);
    5. buffer = file.readAll();
    6. buffer = buffer.toBase64();
    7. file.close();
    8.  
    9. ftp->put(buffer,tempName,QFtp::Binary);
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by racinglocura07; 24th June 2010 at 18:22.

Similar Threads

  1. Replies: 5
    Last Post: 24th January 2009, 18:02
  2. QFtp over QHttp
    By parusri in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2009, 19:16
  3. Synchronizing QFtp
    By arun_vj in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 12:31
  4. Replies: 0
    Last Post: 23rd September 2007, 11:54
  5. QFtp Trouble !
    By Fastman in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 12:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.