Applying custom stylesheet to QWebView

懵懂的女人 提交于 2019-12-22 10:44:37

问题


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);


来源:https://stackoverflow.com/questions/11297181/applying-custom-stylesheet-to-qwebview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!