Возможное решение состоит в том, чтобы ввести css через javascript (как я указал в это решение ):
import QtQuick 2.14
import QtQuick.Window 2.14
import QtWebView 1.14
Window {
visible: true
width: 640
height: 480
QtObject{
id: internals
property string css: "div { background-color: salmon;}"
}
WebView{
anchors.fill: parent
url: "https://stackoverflow.com"
onLoadingChanged: {
if(loadRequest.status == WebView.LoadSucceededStatus){
runJavaScript(loadCSS("foo", internals.css))
}
}
}
function loadCSS(name, css){
var script = "
(function() {
css = document.createElement('style');
css.type = 'text/css';
css.id = '" + name + "'; " +
"document.head.appendChild(css);
css.innerText ='" + css +"'" +
"})()";
return script;
}
}