0

I want to open an local HTML in case you have no internet connection and Loadfinished(bool) property is false. I have my HTML file in resource file called icons.grc in which the path is /html/error.html

When I use the load(QUrl()) function to load the HTML, only blank page is visible. Although the loadfinished() property is true which means it was loaded without any problem.

my code on loading the local url

view->load(QUrl("/html/error.html"));

Any suggestions?

vivekkupadhyay
  • 2,851
  • 1
  • 22
  • 35

1 Answers1

4

If you use .qrc files need to specify file location, so you can do it like this:

view->load(QUrl("qrc:/html/error.html"));

Or you can use QWebEngineView::setHtml() for static content of html pages.

Works fine for me.

t3ft3l--i
  • 1,372
  • 1
  • 14
  • 21
  • Thanks silly me, totally forgot about that qrc because when iwas taking a icon from the resource file i didnt have a problem. Weird. – Alexander Baťka Aug 11 '15 at 11:15