示例#1
0
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;
}
示例#2
0
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() ) );
}