Important: Please read the Qt Code of Conduct -

Simple webkit problem

  • SO i have the following code:
    @ frame->setHtml("<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>");
    QWebElement doc = frame->documentElement();
    QWebElement body = doc.firstChild();
    QWebElement firstParagraph = body.firstChild();
    qDebug() << "text="+firstParagraph.toPlainText();@

    It seems that it returns an empty string. Am I doing something wrong?

  • I just realized what's the problem. it seems that if no <head> tag is created webkit creates one automatically.

    Not sure if this is an error or not. If it's not then there is a documentation error on this from where I get the example.

    Hope this helps.

Log in to reply