Constructing / destructing QApplication causes QWebView to mess up rendering of HTML

Posted by Matthias Ganninger on Stack Overflow See other posts from Stack Overflow or by Matthias Ganninger
Published on 2010-04-09T12:13:22Z Indexed on 2010/04/09 12:23 UTC
Read the original article Hit count: 457

Filed under:
|

We need to create & destroy instances of QApplication, as we want to use Qt in a plug-in to an existing host application.

void multiQT()
{
    int argc = 0;
    QApplication app(argc, NULL);

    QWebView view;
    view.setHtml("<html><head><title>Title</title></head><body><h1>Hello World</h1></body></html>");
    view.show();

    app.exec();
}


main(int argc, char** argv)
{
    // First call works fine, QWebView renders the HTML just fine
    multiQT();

    // Second call fails, QWebView strips HTML tags from HTML text and 
    // and renders "TitleHello World"
 multiQT();
}

When showing the QWebView the second time, it does not render the HTML properly. Do we need to do some additional (re-)initializations in QApplication or QWebView?

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt4