waiting for a signal

前端 未结 3 418
悲哀的现实
悲哀的现实 2020-12-06 11:26

I am working on an application which uploads the content of the file to server.

To upload the file to server I am using ‘QNetworkAccessManager’ class. Since it works

3条回答
  •  猫巷女王i
    2020-12-06 12:04

    I think you need to add something like that in your upload function:

    if (upf->openFile())
    {
        reply = manager->post(request, upf);
        connect(reply, SIGNAL(uploadProgress(qint64,qint64)), this, SIGNAL(progress(qint64,qint64)));
        connect(reply, SIGNAL(finished()), this, SLOT(replyFinished()));
        isInProgress = true;
        emit started();
    } else
    {
        emit finished(true, false, tr("Error: can't open file %1").arg(filename));
    }
    

    Here is the full text code: datacod-qt-tools

    Hope it help.

提交回复
热议问题