My Qt application loads an external html page within a QWebView
widget. How can I define my own stylesheet to present the content of the page? Is it possible to bundle a .css
file for QWebView to pick up?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can load it with the settings of your QWebView
:
QWebView myView;
QWebSettings * settings = myView->settings();
QUrl myCssFileURL;
settings->setUserStyleSheetUrl(myCssFileURL);