Applying custom stylesheet to QWebView
-
i have QWebView widget in gui, but i want to apply a custom css for the HTML.
i put this in the constructor and css.css file in resource system:
@ui->webView->settings()->setUserStyleSheetUrl(QUrl(":resources/css.css"));@
but why this code isn't working correctly? -
Hi,
Probably because it's not a resource path. You are not giving the scheme to your QUrl object.
It should be
@qrc:/resources/css.css@
-
even this is not working :(
just regular HTML -
Did you check that your QUrl resolves correctly ?
-
thank you, i solved the problem
i don't know why, but i tried this in a sub project and didn't work for some reason, and now works perfectly. -
Did you move the resources around ?