Results 1 to 6 of 6

Thread: how to use QNetworkAccessManager to download images in QT

  1. #1
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to use QNetworkAccessManager to download images in QT

    i have to download image using this QnetworkaccessManager
    can any one give some suggestion or few examples coding to use this QNetworkaccessmanager
    Thanks in advance

  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: how to use QNetworkAccessManager to download images in QT

    QNetworkAccessManager docs have an example on using it for downloading a remote document.
    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. The following user says thank you to wysota for this useful post:

    iswaryasenthilkumar (6th March 2015)

  4. #3
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to use QNetworkAccessManager to download images in QT

    i was successfully executed the QNetworkAccessManager.but i cant download the images,,??
    please give me some suggestion for this
    Thanks in Advance


    Added after 39 minutes:


    i got the images name by using QNetworkaccessManager.the names are below

    ("["http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/qzms7p5nfcza55539.jpg","http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/srtsxvvopmu796070.png","http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/qlk7ajrnkh8z82910.png"]")
    i have to split each image path and want to download please help to me to do this.
    Thanks in advance
    Last edited by iswaryasenthilkumar; 6th March 2015 at 05:58.

  5. #4
    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: how to use QNetworkAccessManager to download images in QT

    What have you tried so far to solve your problem? How does the problem differ from your earlier one where you were splitting a list containing file paths?
    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.


  6. #5
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to use QNetworkAccessManager to download images in QT

    i have tried
    Qt Code:
    1. QNetworkAccessManager manager;
    2. QNetworkReply *response = manager.get(QNetworkRequest(QUrl(url)));
    3. QEventLoop event;
    4. connect(response,SIGNAL(finished()),&event,SLOT(quit()));
    5. event.exec();
    6. QString html = response->readAll();
    7. if(html.length() > 0){
    8. str = html.split(",");
    9. for (int i = 0; i < str.size(); ++i)
    10. {
    11. pic=str.at(i);
    12. pic=pic.remove(QRegExp("<img[^>]*src=['|\"]", Qt::CaseInsensitive));
    13. pic = pic.remove(QString::fromStdString("\"" ), Qt::CaseInsensitive);
    14. pic= pic.remove(QRegExp(QString::fromUtf8("\"")));
    15. pic = pic.remove('"');
    16. pic = pic.remove("'");
    17. pic=pic.remove("[");
    18. pic=pic.remove("]");
    19. qDebug()<<pic;
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 
    output :
    i got:
    "http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/qzms7p5nfcza55539.jpg"
    "http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/srtsxvvopmu796070.png"
    "http:\/\/103.3.229.181\/digital-photo-frame-ads\/public\/uploads\/07032015\/qlk7ajrnkh8z82910.png"
    Quote Originally Posted by wysota View Post
    What have you tried so far to solve your problem? How does the problem differ from your earlier one where you were splitting a list containing file paths?
    here
    i cant able to remove "\" in this URL
    please give some example to remove
    Last edited by anda_skoa; 6th March 2015 at 11:24. Reason: missing [code] tags

  7. #6
    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: how to use QNetworkAccessManager to download images in QT

    This seems like a json string, using a json parser would give much better results.
    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.


Similar Threads

  1. Replies: 1
    Last Post: 20th January 2011, 10:26
  2. Replies: 1
    Last Post: 16th November 2010, 17:45
  3. Replies: 3
    Last Post: 17th February 2010, 12:26
  4. Replies: 4
    Last Post: 27th July 2009, 15:45
  5. Download Manager Like IDM(Internet Download Manager)
    By sathiskumarmsk in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2008, 15:52

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.