QNetworkAccessManager
All network-related functionality in Qt is implemented in the Qt Network module. The easiest way to access files on the internet is to use the QNetworkAccessManager
class, which handles the complete communication between your game and the internet.
Setting up a local HTTP server
In our next example, we will be downloading a file over HTTP. If you don't have a local HTTP server, you can just use any publicly available HTTP or HTTPS resource to test your code. However, when you develop and test a network-enabled application, it is recommended that you use a private, local network if feasible. This way, it is possible to debug both ends of the connection, and errors will not expose sensitive data.
If you are not familiar with setting up a web server locally on your machine, there are, luckily, a number of all-in-one installers that are freely available. These will automatically configure Apache2, MySQL (or MariaDB), PHP, and many other servers on your system. On Windows,...