简体   繁体   中英

QT reports “QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once” when requesting a http URL

I'm doing a very small and simple implementation of a protocol where my program will send a specific URL to a target machine and the target will reply with a JSON file.

I have read many examples of how to do this in QT but still I face a log message that I don't understand and I haven't been able to figure out what the problem actually is.

This is parts of my minimalistic code that sends the http request:

The main class:

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_connectToSiteButton_clicked();
    void httpFinished();
    void httpReadyRead();

signals:

private:
    Ui::MainWindow *ui;

    QByteArray *mByteArray;
    QNetworkAccessManager *mNetMan;
    QNetworkReply *reply;

};

This is the implementation of the actual sending of the network request:

    void MainWindow::on_connectToSiteButton_clicked()
{

    mNetMan = new QNetworkAccessManager;
    // Send a Alarm status request
    const QUrl ALARMLIST_URL("http://192.168.1.115/JSON.HTML?FN=ALSummary");

    reply = mNetMan->get(QNetworkRequest(ALARMLIST_URL));
    connect(reply, &QNetworkReply::finished, this, &MainWindow::httpFinished);
    connect(reply, &QIODevice::readyRead, this, &MainWindow::httpReadyRead);
}

When I run the code and press the button I get following message in the Application output window: QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once QUrl(" http://192.168.1.115/JSON.HTML?FN=ALSummary ")

When I search for a solution I find only git comments but no explanation to the cause of this.

这似乎是(同时)已知的错误,将在Qt 5.12.2中修复: QTBUG-72463

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM