Results 1 to 11 of 11

Thread: how to download images using URL link

Threaded View

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

    Default how to download images using URL link

    i have link which contains image..i have to download this image using Qt.i have tried bt i dont get to download..
    can any one give me suggestion for this
    Thanks in Advance
    below code which i tried so far:


    Qt Code:
    1. QUrl url1("http://103.3.229.181/digital-photo-frame-ads\/public/uploads/07032015/qzms7p5nfcza55539.jpg");
    2. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    3. connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(netwManagerFinished(QNetworkReply*)));
    4. QNetworkRequest request(url1);
    5. manager->get(request);
    6.  
    7.  
    8. void Widget::netwManagerFinished(QNetworkReply *reply)
    9. {
    10. QByteArray jpegData = pic.toLocal8Bit();
    11. QPixmap pixmap;
    12. pixmap.loadFromData(jpegData);
    13. QPixmap scaled = pixmap.scaled(128,64,Qt::IgnoreAspectRatio, Qt::FastTransformation);
    14. l.setPixmap(scaled);
    15. l.show();
    16. QString filename = QFileDialog::getSaveFileName(this, tr("Save Skin"), "/home/ihorse1/10-03-2015", ,tr("JPEG Image(*.jpg)"));
    17. QFile file (filename);
    18. file.open(QIODevice::WriteOnly);
    19. QDataStream out (&file);
    20. out << reply;
    21. qDebug()<<out;
    22. file.close();
    23. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 9th March 2015 at 07:41. Reason: changed [quote] to [code]

Similar Threads

  1. how to use QNetworkAccessManager to download images in QT
    By iswaryasenthilkumar in forum Newbie
    Replies: 5
    Last Post: 6th March 2015, 09:54
  2. Replies: 1
    Last Post: 5th October 2012, 11:08
  3. Qhttp Get file size in Link download
    By nhs_0702 in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2010, 09:24
  4. How to open download link with WebKit
    By myrky in forum Newbie
    Replies: 1
    Last Post: 9th July 2009, 07:11
  5. QTWebKit unable to load download link
    By myrky in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2009, 07:09

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.