Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to get network reply information using QWebEngineView
Forum Updated to NodeBB v4.3 + New Features

How to get network reply information using QWebEngineView

Scheduled Pinned Locked Moved Unsolved QtWebEngine
5 Posts 4 Posters 4.2k 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.
  • GoneWithTheFoodG Offline
    GoneWithTheFoodG Offline
    GoneWithTheFood
    wrote on last edited by GoneWithTheFood
    #1

    Hi,
    recently I'm trying to migrate my webkit codes into webengine, but I've got some problems getting the network reply information.
    I tried to visit a webpage on my own server using a https link, but somehow it doesn't work. I guess there're some setting errors, but how can I get this errors?
    I used the onFinished() and sslError() signals of QNetworkAccessManager before, but according to the documentation, the webengine doesn't go through QNetworkAccessManager any more.
    Is there any methods in webengine instead, so that I can get the reply information?

    1 Reply Last reply
    0
    • Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by
      #2

      Hi @GoneWithTheFood,

      I haven't used Qt WebEngine personally, but at a quick glance, those two signals might have the following approximate equivalents:

      • QNetworkAccessManager::finished => QWebEngineView::loadFinished
      • QNetworkAccessManager::sslErrors => QWebEnginePage::certificateError

      Note however, that certificateError is not a signal, but a protected virtual function. I guess this gives more flexibility (it allows you to actually choose how to respond to the error), but probably requires you to sub-class QWebEnginePage to override that virtual method (perhaps to emit your own signal?), then use QWebEngineView::setPage to use an instance of your custom QWebEnginePage class.

      Of course, this is all just speculation... I'm sure someone with actual Qt WebEngine experience could offer better advice. But hopefully this gives you something to look at in the meantime.

      Cheers.

      GoneWithTheFoodG 1 Reply Last reply
      0
      • Paul ColbyP Paul Colby

        Hi @GoneWithTheFood,

        I haven't used Qt WebEngine personally, but at a quick glance, those two signals might have the following approximate equivalents:

        • QNetworkAccessManager::finished => QWebEngineView::loadFinished
        • QNetworkAccessManager::sslErrors => QWebEnginePage::certificateError

        Note however, that certificateError is not a signal, but a protected virtual function. I guess this gives more flexibility (it allows you to actually choose how to respond to the error), but probably requires you to sub-class QWebEnginePage to override that virtual method (perhaps to emit your own signal?), then use QWebEngineView::setPage to use an instance of your custom QWebEnginePage class.

        Of course, this is all just speculation... I'm sure someone with actual Qt WebEngine experience could offer better advice. But hopefully this gives you something to look at in the meantime.

        Cheers.

        GoneWithTheFoodG Offline
        GoneWithTheFoodG Offline
        GoneWithTheFood
        wrote on last edited by GoneWithTheFood
        #3

        Hi @Paul-Colby ,
        thx for the reply. :)
        I've also noticed these two methods, but somehow can't get through with them.
        The difference between the finished signal of access manager and webengine view is that , the loadFinished signal gives no concrete information about the network reply. As mentioned before, those reply information is what I need to analyze the reason of my connection failure.
        The certificateError method looks very interesting, but I just couldn't trigger it...I've tried to sub-class QWebEnginePage and override this method with a simple qDebug string, but nothing happened at all. I guess there should be some other way to use this method and will look into it further.

        Anyway, thanks very much for the advices.:D

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexnum
          wrote on last edited by
          #4

          With the help of you guys i could soulve it, and posted the answer here:
          http://www.qtcentre.org/threads/14398-Use-of-QWebView-to-browse-quot-https-quot-secure-sites?p=293854#post293854

          1 Reply Last reply
          0
          • T Offline
            T Offline
            thinguy3n
            wrote on last edited by
            #5

            I know it has been a while but I'm just curious if you ever found a solution for this?

            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