First, create an instance of
QNetworkAccessManager *m_nam = new QNetworkAccessManager(this);
QObject, it takes a pointer to
QObject, which is used as a parent. Thus, you do not have to take care of deleting the manager later on. Furthermore, one single instance of
QNetworkAccessManager is enough for an entire application. So, either pass a pointer to the network access manager in your game or, for ease of use, create a singleton pattern and access the manager through that.
A singleton pattern ensures that a class is instantiated only once. The pattern is useful for accessing application-wide configurations or—as in our case—an instance of