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. load() and seturl() not updating page
Forum Updated to NodeBB v4.3 + New Features

load() and seturl() not updating page

Scheduled Pinned Locked Moved Unsolved QtWebEngine
9 Posts 3 Posters 3.3k Views
  • 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.
  • P Offline
    P Offline
    ppmm
    wrote on last edited by ppmm
    #1

    Hello, I successfully implemented my webengineview for a single page and its dependencies. As I started using it with tensorboard then I could normally open its address.

    localhost::6006
    

    All pages with this initial address in common would also work however lets say I want to change from google page to localhost tensorboard page

    m_webEngineView->load(QUrl("http://www.google.com"));
    

    then using load() or seturl() methods does not work. For both methods my webengineview->URL() is successfully defined but it still exhibits the old page, and if I right click and reload it goes back to old page.

    If I create a new webenginepage and webengineview->setpage() then the old page is erased but instead of a the new page only a blank page is exhibited.

    QWebEnginePage* hostpage = new QWebEnginePage(m_webEngineView);
    hostpage->setUrl("http://localhost:6006/#projector&run=train");
    hostpage->load("http://localhost:6006/#projector&run=train");
    m_webEngineView->setPage(hostpage);
    m_webEngineView->load("http://localhost:6006/#projector&run=train");
    

    Is this an expected behavior ? should I set any different property to change pages in the webengineview ?

    thanks.

    eyllanescE 1 Reply Last reply
    0
    • P ppmm

      Hello, I successfully implemented my webengineview for a single page and its dependencies. As I started using it with tensorboard then I could normally open its address.

      localhost::6006
      

      All pages with this initial address in common would also work however lets say I want to change from google page to localhost tensorboard page

      m_webEngineView->load(QUrl("http://www.google.com"));
      

      then using load() or seturl() methods does not work. For both methods my webengineview->URL() is successfully defined but it still exhibits the old page, and if I right click and reload it goes back to old page.

      If I create a new webenginepage and webengineview->setpage() then the old page is erased but instead of a the new page only a blank page is exhibited.

      QWebEnginePage* hostpage = new QWebEnginePage(m_webEngineView);
      hostpage->setUrl("http://localhost:6006/#projector&run=train");
      hostpage->load("http://localhost:6006/#projector&run=train");
      m_webEngineView->setPage(hostpage);
      m_webEngineView->load("http://localhost:6006/#projector&run=train");
      

      Is this an expected behavior ? should I set any different property to change pages in the webengineview ?

      thanks.

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @ppmm "www.google.com" is not a valid url, in that case it is better to use QUrl::fromUserInput("www.google.com")

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      P 1 Reply Last reply
      1
      • eyllanescE eyllanesc

        @ppmm "www.google.com" is not a valid url, in that case it is better to use QUrl::fromUserInput("www.google.com")

        P Offline
        P Offline
        ppmm
        wrote on last edited by
        #3

        @eyllanesc Sorry I just posted it really fast, but the URL is working properly, just shortenned it. gonna fix in the post

        JonBJ 1 Reply Last reply
        0
        • P ppmm

          @eyllanesc Sorry I just posted it really fast, but the URL is working properly, just shortenned it. gonna fix in the post

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @ppmm
          In principle QWebEngineView::load() should load a different page fine. Try a minimal program to verify.

          After you set of your load()s, you do allow the event loop to run, don't you? Loading a page happens asynchronously. You might check what is going on for you via QWebEngineView::loadFinished(bool ok) signal, or others.

          P 1 Reply Last reply
          0
          • JonBJ JonB

            @ppmm
            In principle QWebEngineView::load() should load a different page fine. Try a minimal program to verify.

            After you set of your load()s, you do allow the event loop to run, don't you? Loading a page happens asynchronously. You might check what is going on for you via QWebEngineView::loadFinished(bool ok) signal, or others.

            P Offline
            P Offline
            ppmm
            wrote on last edited by
            #5

            @JonB just found out an interesting thing. It might be a problem inside my code. If I go for

            webengineview->load() before my core computing it works like a charm, however if I call the method afterwards it does not work, it looks like it is changing the page somewhere else.

            JonBJ 1 Reply Last reply
            0
            • P ppmm

              @JonB just found out an interesting thing. It might be a problem inside my code. If I go for

              webengineview->load() before my core computing it works like a charm, however if I call the method afterwards it does not work, it looks like it is changing the page somewhere else.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @ppmm
              When you call QWebEngineView::load(), understand that call does not load and display a page. It starts the process of downloading the page, that's all. The next line of your code continues, with the loading proceeding asynchronously, in the background. During that process you will receive the signals listed in https://doc.qt.io/qt-5/qwebengineview.html#signals, like loadStarted/Progress/Finished(). Put slots on those to see what's happening. They will only fire, and the downloading proceed, provided you do no block the Qt event loop. Finally, the page will not render until the download has completed. Your "only a blank page is exhibited" might be an indication that the download has not been allowed to complete.

              P 1 Reply Last reply
              2
              • JonBJ JonB

                @ppmm
                When you call QWebEngineView::load(), understand that call does not load and display a page. It starts the process of downloading the page, that's all. The next line of your code continues, with the loading proceeding asynchronously, in the background. During that process you will receive the signals listed in https://doc.qt.io/qt-5/qwebengineview.html#signals, like loadStarted/Progress/Finished(). Put slots on those to see what's happening. They will only fire, and the downloading proceed, provided you do no block the Qt event loop. Finally, the page will not render until the download has completed. Your "only a blank page is exhibited" might be an indication that the download has not been allowed to complete.

                P Offline
                P Offline
                ppmm
                wrote on last edited by
                #7

                @JonB I am currently using the signals and I noticed that previous to my core computing the loading progress take a few seconds to reach 100% and then emits the loadfinished, however after my core computing the loading progress takes milliseconds and emits load finished but does not update the page. For both scenarios I am loading the youtube page for comparison.

                Does it makes any sense? It looks like some sort of lock not allowing me to update the page but my code is not locking the webengineview, I have changed it to the more external and internal allowed and both cases resulted the same

                JonBJ 1 Reply Last reply
                0
                • P ppmm

                  @JonB I am currently using the signals and I noticed that previous to my core computing the loading progress take a few seconds to reach 100% and then emits the loadfinished, however after my core computing the loading progress takes milliseconds and emits load finished but does not update the page. For both scenarios I am loading the youtube page for comparison.

                  Does it makes any sense? It looks like some sort of lock not allowing me to update the page but my code is not locking the webengineview, I have changed it to the more external and internal allowed and both cases resulted the same

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @ppmm
                  I'm sorry but I have no idea what your code might or might not be doing.

                  As I said, the usual way is to knock up a 10-line standalone, minimal example, and compare its behaviour to your complex code.

                  P 1 Reply Last reply
                  1
                  • JonBJ JonB

                    @ppmm
                    I'm sorry but I have no idea what your code might or might not be doing.

                    As I said, the usual way is to knock up a 10-line standalone, minimal example, and compare its behaviour to your complex code.

                    P Offline
                    P Offline
                    ppmm
                    wrote on last edited by ppmm
                    #9

                    @JonB found it, looks like I was changing directory during core computing and webengineview could not find the .dll anymore but somehow did not complain about that.

                    Thanks for all support

                    I am just wondering if qwebengineview should not emit a warning or something when .dll not found...

                    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