Results 1 to 5 of 5

Thread: SIGNAL in QNetworkReply error - SOLVED -

  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 14:26.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: SIGNAL in QNetworkReply error

    No, qint64 and quint64 are different types.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: SIGNAL in QNetworkReply error

    From the QNetworkReply::downloadProgress doc : If the number of bytes to be downloaded is not known, bytesTotal will be -1. How You want to convert it to the unsigned type ?

  4. #4
    Join Date
    May 2015
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: SIGNAL in QNetworkReply error

    Thanks for the reply.

    Really I need clean my glasses

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: SIGNAL in QNetworkReply error

    You should also see a run time warning message that the connect() call failed because the target was missing.

Similar Threads

  1. Replies: 1
    Last Post: 13th March 2013, 09:21
  2. How to find the error in QNetworkReply?
    By Gokulnathvc in forum Newbie
    Replies: 13
    Last Post: 20th April 2012, 10:40
  3. Replies: 1
    Last Post: 29th June 2011, 23:07
  4. QNetworkReply & delayed readyRead(() signal
    By dmini in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2009, 13:47
  5. QNetworkReply error handling
    By timmu in forum Qt Programming
    Replies: 5
    Last Post: 25th August 2009, 09: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.