void IconLoader::finished() { if (m_reply->error() != QNetworkReply::NoError) { emit error(); } else { const QByteArray data = m_reply->readAll(); emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data)))); } delete m_reply; m_reply = Q_NULLPTR; }
TopLevel::TopLevel() : QWebView(0) { m_page = new Page(); setPage( m_page ); QWebSettings::globalSettings()->setAttribute( QWebSettings::PluginsEnabled, true ); QWebSettings::setIconDatabasePath( QString("./icons") ); QIcon icon = QWebSettings::iconForUrl( QUrl("http://mail.google.com/") ); qDebug() << icon; setWindowTitle( QString("GMail") ); setUrl( QUrl("http://mail.google.com/") ); connect( m_page->mainFrame(), SIGNAL( iconChanged() ), SLOT( iconLoaded() ) ); }