Results 1 to 5 of 5

Thread: SIGNAL in QNetworkReply error - SOLVED -

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default SIGNAL in QNetworkReply error - SOLVED -

    Hello everybody:

    In a small app that download a file from a url, I have this code:

    MyClasse.h
    Qt Code:
    1. ...
    2. ...
    3. private slots:
    4. void downloadProgressShow(quint64 bytesRead, quint64 bytesTotal);
    5. ...
    6. ...
    To copy to clipboard, switch view to plain text mode 

    myclasse.cpp
    Qt Code:
    1. ...
    2. ...
    3. void MyClasse::on_btnDownload_clicked()
    4. {
    5. ...
    6. QNetworkAccessManager *manager = new QNetworkAccessMananger(this);
    7. QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("http://www .....")));
    8. // --- Show the progress.
    9. connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadProgressShow(qint64,quint64)));
    10.  
    11. // --- When download finished, save the file.
    12. connect(manager,SIGNAL(finished(QNetworkReply *)),this,SLOT(saveFileDownloaded(QNetworkReply *)));
    13. }
    14.  
    15. void MyClasse::downloadProgressShow(qint64 bytesRead, quint64 bytesTotal)
    16. {
    17. qDebug() << QString::number(bytesRead).toLatin1() + " bytes of " + QString::number(bytesTotal).toLatin1();
    18. }
    To copy to clipboard, switch view to plain text mode 


    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.
    Last edited by monillo; 14th May 2015 at 15:26.

Similar Threads

  1. Replies: 1
    Last Post: 13th March 2013, 10:21
  2. How to find the error in QNetworkReply?
    By Gokulnathvc in forum Newbie
    Replies: 13
    Last Post: 20th April 2012, 11:40
  3. Replies: 1
    Last Post: 30th June 2011, 00:07
  4. QNetworkReply & delayed readyRead(() signal
    By dmini in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2009, 14:47
  5. QNetworkReply error handling
    By timmu in forum Qt Programming
    Replies: 5
    Last Post: 25th August 2009, 10:07

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
  •  
Qt is a trademark of The Qt Company.