1. QWebView loads html from resource
As you can search on the Net, many peole write codes like
webView->setUrl(QUrl::fromLocalFile(":/html/homepage.html"));But it won't work. Using qDebug() to output its url, the only thing you can get is "about:blank". You should write like this:
webView->setUrl(QUrl("qrc:///html/homepage.html"));
P.S. To get your resource path, just open the resource editor in Qt creator, right-click on the target resource and choose "Copy Resource Path to clipboard".
to be continued...
No comments:
Post a Comment