I am using a QWebView to display some content and I want to use custom CSS to spruce up the output. I found that I can use the QWebSettings.setUserStyleSheetUrl()
method to load my own CSS into the view. The .css
file is in the same directory as my main program.
self.webview = QWebView(MainWindow)
self.webview.settings().setUserStyleSheetUrl(QUrl.fromLocalFile("myCustom.css"))
However, the custom stylings don't load when I add the content to the page using setHtml()
. I have tested that the CSS is properly applying to the HTML in a standard browser.
Any idea what I am doing wrong?