Let's say we have a barebones QWebView:
#include <QApplication>
#include <QWebView>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QWebView view;
view.show();
view.setUrl(QUrl("http://google.com"));
return app.exec();
}
How can I display a graphic overlay, preferably fullscreen with transparency and minimal animation (like timer/beachball/etc.) from when the page starts loading till it's finished? Should also be triggered when url changes from within the QWebView.
You can use the
LoadingOverlay
class provided in this answer to draw an overlay over anyQWidget
. In your case, show the overlay on top of theQWebView
when the signalloadStarted
is triggered and hide it, when the signalloadFinished
is triggered.The following code should get you started. I put the code from the linked answer into
overlay.h
, the subclass ofQWebView
which handles the showing/hiding of the overlay is inwebview.h
:webview.h
main.cpp