How do I display local HTML in QWebview?

后端 未结 2 1011
长情又很酷
长情又很酷 2021-02-08 13:35

I suspect this is so basic that no one bothered to document it.

I want to write an HTML file from my program, and then load that file into a QWebview object.

Whe

2条回答
  •  庸人自扰
    2021-02-08 13:58

    From the web

    webView->load(QUrl("http://google.de"));
    

    From resource

    webView->load(QUrl("qrc:///sample.html"));
    

    From File System

    webView->load(QUrl("file:///C:/sample.htm"));
    

    No need for QUrl::FromLocalFile, no need for webView->show()

    You are all welcome!

提交回复
热议问题