How to properly process an QNetworkReply in QWebPage::unsupportedContent ?



  • Hello to everyone.

    I get a strange behavior while getting an unsupportedContent signal from QWebPage.

    Have a look at this piece of code:

    @
    webView->page()->setForwardUnsupportedContent(true);
    connect(webView->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(onUnsupportedContent(QNetworkReply*)));
    connect(webView,SIGNAL(loadFinished(bool)),this,SLOT(onLoadFinished(bool)));@

    When i click on the link on the page, loaded with QWebView, the web server responses the file. At first click, this signal is properly raised and processed via connected slot. But any other click on that link has no effect: there is no request to web server, but any other links on page still work.

    And the slot:
    @
    void MainWindow::onUnsupportedContent(QNetworkReply reply)
    {
    QString file_name = QFileDialog::getSaveFileName(this, tr("Save as"),
    QString(), tr("Table(
    .xls)"));
    QFile file(file_name);
    if (!file.open(QIODevice::WriteOnly))
    return;

    file.write(reply->readAll());
    file.close();
    reply->close();
    reply->deleteLater();
    

    }
    @

    And my question is: what should i do to process each click on that link, not only the first click? QWebView should requests webserver each time, user clicks on that link, not only the first click.






Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.