S B
S B

Reputation: 8384

Applying custom stylesheet to QWebView

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?

Upvotes: 3

Views: 3640

Answers (1)

air-dex
air-dex

Reputation: 4180

You can load it with the settings of your QWebView :

QWebView myView;
QWebSettings * settings = myView->settings();
QUrl myCssFileURL;
settings->setUserStyleSheetUrl(myCssFileURL);

Upvotes: 2

Related Questions