Important: Please read the Qt Code of Conduct -

load() and seturl() not updating page

  • 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.


    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


    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);

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


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

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

  • @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.

  • @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.

  • @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, 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.

  • @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

  • @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.

  • @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...

Log in to reply