Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to properly process an QNetworkReply in QWebPage::unsupportedContent ?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koledennix
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koledennix
      wrote on last edited by
      #2
      1 Reply Last reply
      0
      • K Offline
        K Offline
        koledennix
        wrote on last edited by
        #3
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved