Core::FileIconProvider: Add helper method to get a directory icon with overlay

Add a helper method to request a directory icon with an overlay icon for the
project tree.

Change-Id: Idea2ea9ec2ea6790bf8d087723700364fbcafec6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-09-06 11:32:15 +02:00
parent bae73e7246
commit 1cf1700d1c
7 changed files with 26 additions and 50 deletions

View File

@@ -217,5 +217,18 @@ void registerIconOverlayForFilename(const QString &path, const QString &filename
instance()->registerIconOverlayForFilename(QIcon(path), filename);
}
// Return a standard directory icon with the specified overlay:
QIcon directoryIcon(const QString &overlay)
{
// Overlay the SP_DirIcon with the custom icons
const QSize desiredSize = QSize(16, 16);
const QPixmap dirPixmap = QApplication::style()->standardIcon(QStyle::SP_DirIcon).pixmap(desiredSize);
const QIcon overlayIcon(overlay);
QIcon result;
result.addPixmap(Core::FileIconProvider::overlayIcon(dirPixmap, overlayIcon));
return result;
}
} // namespace FileIconProvider
} // namespace Core