I've got a webView setup to display chat message.
I'm initiating it like this:
ui->webView->setHtml("
Hello
");
(The above code is all on one line in QT, I just hit enter to make it easier to read here)
Now I'm trying to figure out how to append div's it to in the form of new chat messages.
Tried to append like this:
QString html = "
QString js = QString("document.execCommand('InsertHTML',false,'%1');").arg(html);
ui->webView->page()->mainFrame()->evaluateJavaScript(js);
Switching out the date works fine, I do that like this:
// Switches out the date
QWebFrame *pSource = ui->webView->page()->mainFrame();
QWebElement dateDiv = pSource->findFirstElement("#date");
dateDiv.replace("
However inserting new div's is what i cannot get to work.
Any ideas what I'm doing wrong?