Important: Please read the Qt Code of Conduct -

QNetworckAccessManager & Connecting

  • Hi,
    I want to download a list of icons for the items of my QStandardItemModel (appsModel). when I do this it does nothing:

    void MainWindow::downloadIcons()
    for (int i=0; i<appsModel->rowCount(); ++i)
    QUrl iconUrl("");

        QNetworkRequest request(iconUrl);
        QNetworkAccessManager *tempManager = new QNetworkAccessManager;


    for now the link is the google image but I will set it to the data of items of my model. It's just for testing. what am I doing wrong?

  • Lifetime Qt Champion


    You should also connect the error signal

    By the way, why are you re-creating a new QNetworkAccessManager each time ?

  • Hi, @SGaist
    My code doesn't work. I can't see how the problem is related to connecting the error signal. can you explain?

    And also What do you mean by one QNetworkAccessManager? How can I do that?

  • Lifetime Qt Champion

    That would allow you to know that something wrong happened by at least printing the error on the console.

    I mean don't recreate one each time you send a request. Currently you also have a memory leak since you never delete them.

    Just add one as a member of your MainWindow class and use it to send all the requests.

  • Hi, thank you the problem is solved

Log in to reply