the QWebEngineView signal of loadfinished is not very precise
-
I made a project used the QWebEngineView,and connect the signal loadfinished to the slot function.but when I get the signal from the QWebEngineView which loadfished,i found that the QWebEngineView dosent loaded all the elements of the webview,in fact the QWebEngineView was still rendering the web resources.so how could i get the precise signal that the QWebEngineView was totally rendered.
-
I made a project used the QWebEngineView,and connect the signal loadfinished to the slot function.but when I get the signal from the QWebEngineView which loadfished,i found that the QWebEngineView dosent loaded all the elements of the webview,in fact the QWebEngineView was still rendering the web resources.so how could i get the precise signal that the QWebEngineView was totally rendered.
@nicker-player
loadFinished()
is issued when the engine finishes loading the HTML page. This does not mean everything on the page is "finished" as there can be further processing, JavaScript etc. I found I needed to write some JavaScript/jQuery attached to "onload"/"DOMContentLoaded"/"document ready" if you want to act on the page being "finished" client-side. -
@nicker-player
loadFinished()
is issued when the engine finishes loading the HTML page. This does not mean everything on the page is "finished" as there can be further processing, JavaScript etc. I found I needed to write some JavaScript/jQuery attached to "onload"/"DOMContentLoaded"/"document ready" if you want to act on the page being "finished" client-side.@JonB
so could u just give a little more detail information about that?
its would be better if u could give me a demo or a link.its hard for me to get the tips from the internet. -
@JonB
so could u just give a little more detail information about that?
its would be better if u could give me a demo or a link.its hard for me to get the tips from the internet.@nicker-player
I am afraid I used this years ago, I cannot find any source of mine using it and am hazy as to what I did how.For your case, is the page/HTML you are using in your
QWebEngineView
constructed by your code or is it an external URL? If it's the former, your own, you can put some JS into it to run on "document ready" JS/jQuery. If it's the latter, an external URL, I am not sure when you can use, say,runJavaScript
to inject the JS code.Alternatively, I think you are now encouraged to use
QWebChannel
inQWebEnginePage
to communicate "properly" with the JS and hence the DOM model. This did not yet exist when I did work years ago. An example in Python seems to be https://riverbankcomputing.com/pipermail/pyqt/2015-August/036346.html, there may be other/better ones. The important thing is that usesscript.setInjectionPoint(QWebEngineScript.DocumentReady)
to install the script to run on the page's "document ready".I am afraid I am not going to be able to give any more precise suggestions that the above.