Ticket #205: fileicons.diff

File fileicons.diff, 2.3 KB (added by rudi, 13 years ago)

Fix for unblured file icons

  • src/plugins/coreplugin/fileiconprovider.cpp

     
    159159{
    160160    QPixmap iconPixmap = qApp->style()->standardIcon(baseIcon).pixmap(size);
    161161    QPainter painter(&iconPixmap);
    162     painter.drawPixmap(0, 0, overlayIcon.pixmap(size));
     162    QPixmap overlayPixmap = overlayIcon.pixmap(size);
     163    painter.drawPixmap((size.width() - overlayPixmap.width()) / 2,
     164                       (size.height() - overlayPixmap.height()) / 2, overlayPixmap);
    163165    painter.end();
    164166    return iconPixmap;
    165167}
     
    178180
    179181    QTC_ASSERT(!icon.isNull() && !suffix.isEmpty(), return)
    180182
    181     const QPixmap fileIconPixmap = overlayIcon(QStyle::SP_FileIcon, icon, QSize(16, 16));
     183    const QPixmap fileIconPixmap = overlayIcon(QStyle::SP_FileIcon, icon, iconSize());
    182184    // replace old icon, if it exists
    183185    const CacheIterator it = findBySuffix(suffix, d->m_cache.begin(), d->m_cache.end());
    184186    if (it == d->m_cache.end()) {
     
    208210    return FileIconProviderPrivate::m_instance;
    209211}
    210212
     213/*!
     214  Returns the size of a small icon
     215  */
     216
     217QSize FileIconProvider::iconSize()
     218{
     219    int s = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize);
     220    return QSize(s, s);
     221}
     222
    211223} // namespace core
  • src/plugins/coreplugin/fileiconprovider.h

     
    6969
    7070    static FileIconProvider *instance();
    7171
     72    static QSize iconSize();
     73
    7274private:
    7375    FileIconProviderPrivate *d;
    7476};
  • src/plugins/projectexplorer/foldernavigationwidget.cpp

     
    149149#endif
    150150    m_fileSystemModel->setFilter(filters);
    151151    m_filterModel->setSourceModel(m_fileSystemModel);
    152     m_listView->setIconSize(QSize(16,16));
     152    m_listView->setIconSize(Core::FileIconProvider::iconSize());
    153153    m_listView->setModel(m_filterModel);
    154154    m_listView->setFrameStyle(QFrame::NoFrame);