I am having a bit of a problem when trying to use QWebView->setHtml(), the below code is just the snippet of my code that actually uses the function, but it doesn't seem to matter what I have the HTML string set as, it always results in a segfault, any ideas on why and how to fix the issue?

Qt Code:
  1. void mtg::finishedSlot(bool) {
  2. QWebElementCollection elements = ui->webView->page()->mainFrame()->findAllElements("div");
  3. QString HTML("<html><body>");
  4.  
  5. foreach(QWebElement element, elements) {
  6. if(element.attribute("class") == "sr") {
  7. HTML.append(element.toOuterXml());
  8. }
  9. }
  10. HTML += "</body></html>";
  11. ui->webView->setHtml(HTML);
  12.  
  13. }
To copy to clipboard, switch view to plain text mode