How it works…

In this example, we used C++ to load an image file and set it as the WebView's default content (instead of a blank page). We could achieve the same result by loading a default HTML file with an image at startup.

Some of the code in the class constructor has been commented out. You can remove the double slashes, //, and see the difference it makes  the JavaScript alert will no longer appear (since JavaScript is disabled) and images will no longer appear in your webview.

Another thing you can try is to change the font family from QWebEngineSettings::SansSerifFont to QWebEngineSettings::SerifFont. You will notice a slight difference in the font as it appears in the webview:

By clicking the Load HTML button, we ask the WebView to treat the content of the Plain Text Edit widget as HTML code and load it as an HTML page. You can use this to make a simple HTML editor powered by Qt!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset