Download Data from URL

From Qt Wiki
Revision as of 15:20, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English Български 한국어فارسی

Download Data from URL

The following code snippet demonstrates how to download data as QByteArray [qt.io] from URL. The downloaded data can be saved as a file or converted to appropriate object. For example if an image is downloaded it can be converted to QPixmap [qt.io] or QImage [qt.io] using method loadFromData() [qt.io]

Please note that although the name of the class is FileDownloader the downloaded data is not saved on the disk as file!

Important Classes

.pro File

If you are targeting Symbian devices remember to add the capability for network services.

filedownloader.h

filedownloader.cpp

Usage

Load Pixmap from URL

  • Declare slot
  • Connect signal downloaded() to the slot
  • Load QPixmap from the downloaded data

Categories: