[webkit-qt] how to load image from QImage in QWebView?

brook.hong at nokia.com brook.hong at nokia.com
Fri Apr 1 03:04:38 PDT 2011


hi

QWebView* webView;
webView->setPage(new WebPage);
webView->setHtml("<html> <head> </head> <body> <img src='mydata://test.png'> </body> </html>");

The test.png was read into an instance of QImage from database.

The problem is how to make test.png displayed in the webView.

I have customized WebPage::acceptNavigationRequest,

bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
    QString sch = request.url().scheme();
    if(sch == QLatin1String("mydata")){
        //never reach here
        QString imgName = request.url().host();
    }
    return QWebPage::acceptNavigationRequest(frame, request, type);
}


----------------
Best Regards,
Brook Hong



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20110401/4a017e38/attachment.html>


More information about the webkit-qt mailing list