I have a desktop c++/qt gui app, that is using QWebview as its central widget.
I am struggling to do something which seems fairly trivial. I want to add an element to a web page from qt like the following example
<body>
<h1>When Are You Going To Fix This</h1>
</body>
to
<body>
<h1>When Are You Going To Fix This</h1>
<p>I am doing it now</p>
</body>
I have tried and other variations
//.. Gui set up and url loaded into webview
// my attempt at adding a new HTML element
QWebFrame * frame = ui->webView->page()->mainFrame();
QWebElement body = frame->documentElement().findFirst("BODY");
if(!body.isNull()){
QWebElement newElem; //create a new element to
newElem.appendInside("<p>I am doing it now</p>");
newElem.appendInside(body);
}
I have also tried creating a new element and building the desired parts but to no avail
QWebFrame * frame = ui->webView->page()->mainFrame();
QWebElement body = frame->documentElement().findFirst("BODY");
if(!body.isNull()){
QWebElement newElem; //create a new element to
newElem.setAttribute("TAG", "P");
newElem.setAttribute("innerHTML", "I am doing it now");
newElem.appendInside(body);
}
Is it possible to do this with the qt webkit or am I missing something blantly obvious..?