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.
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.
-
@ppmm
In principleQWebEngineView::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 viaQWebEngineView::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 callQWebEngineView::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, likeloadStarted
/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
-
@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...