Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to download images from url

How to download images from url

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 661 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by
    #1

    Hi guys,,,,
    im trying to download images via url ,,,
    please help me to slove this

    thanks in advance

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2
      QUrl url = QUrl::fromUserInput(QStringLiteral("https://upload.wikimedia.org/wikipedia/commons/0/0b/Qt_logo_2016.svg"));
      QFile* destinationFile= new QFile(QStringLiteral("QtLogo.svg"));
      Q_ASSUME(destinationFile->open(QFile::WriteOnly));
      QNetworkAccessManager* manager = new QNetworkAccessManager(this);
      QNetworkReply* reply = manager->get(QNetworkRequest(url));
      connect(reply,&QNetworkReply::readyRead,destinationFile,[destinationFile,reply](){destinationFile->write(reply->readAll());});
      connect(reply,&QNetworkReply::finished,destinationFile,&QFile::deleteLater);
      connect(reply,&QNetworkReply::finished,reply,&QNetworkReply::deleteLater);
      

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved