views:

26

answers:

0

Below is a small QtJambi code to download contents from a webpage.

public void loadDone() 
{
    QNetworkAccessManager nm=new QNetworkAccessManager();
    nm.finished.connect(this,"done(QNetworkReply)");
    nm.get(new QNetworkRequest(new QUrl("http://www.bing.com")));
}
public void done(QNetworkReply reply)
{
    QByteArray ba=reply.readAll();  
    QPixmap ob=new QPixmap();
    System.out.println(ba);
    ob.loadFromData(ba);
    siteIcon.setIcon(new QIcon(ob));
}

This prints the contents of QByteArray. The problem is that if I add "/favicon.ico" to the url, it doesn't print anything. Why ? I actually want to download the favicon associated with the given site. Also, the demo Webkit example doesn't open the URLs with favicon.ico at the end.