Results 1 to 3 of 3

Thread: Simplest data download code doesnt work :(

  1. #1
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Simplest data download code doesnt work :(

    Hi, i've been trying to understand the network system, but this simple code doesnt work.
    please could anybody tell me why??
    thanks

    Qt Code:
    1. QUrl imgURL("http://www.convocatoria09.fecyt.es/img/logotipos/logo-ucc-jpg.jpg");
    2. QNetworkAccessManager manager;
    3. QNetworkRequest request(imgURL);
    4. manager.get(request);
    5.  
    6. connect(&manager, SIGNAL( finished(QNetworkReply*)), SLOT(loadIMG(QNetworkReply*)));
    To copy to clipboard, switch view to plain text mode 

    and the loadIMG() function, just a debug

    Qt Code:
    1. void loadCover( QNetworkReply* reply ) {
    2.  
    3. qDebug() << QString("Ok!");
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Simplest data download code doesnt work :(

    loadIMG() != loadCover(). Please post your actual code and don't make one up for the forum. And the problem you are facing is a standard C++ error. You have to create QNetworkAccessManager on the heap, because otherwise it gets destroyed at the end of the scope, thus the signal can never be emitted.

  3. #3
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Simplest data download code doesnt work :(

    sorry for that error, thats because i was doing some changes while was posting , and thanks a lot for the reply.
    Thanks and sorry for bothering.

Similar Threads

  1. Qwt Tex Text Doesnt work for me
    By gbmtoday in forum Qwt
    Replies: 1
    Last Post: 21st November 2010, 19:48
  2. connect doesnt work
    By john_god in forum Newbie
    Replies: 4
    Last Post: 23rd November 2008, 09:36
  3. ldapsearch doesnt work.
    By shamik in forum General Discussion
    Replies: 0
    Last Post: 3rd April 2008, 07:25
  4. QFtp...doesnt seems to work ....!!!
    By salmanmanekia in forum Qt Programming
    Replies: 10
    Last Post: 25th February 2008, 08:30
  5. How come this doesnt work?
    By ShaChris23 in forum Newbie
    Replies: 8
    Last Post: 16th June 2007, 04:43

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.