diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-09-06 11:32:15 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-09-08 11:18:09 +0000 |
commit | 1cf1700d1ca076298bf9095e2547490aa662e80a (patch) | |
tree | ba291a971c17b707d2a3d57fe8ac15e6404d6fa2 /src/plugins/coreplugin/fileiconprovider.cpp | |
parent | bae73e72468fae476d4b6c5eae839ba277cb6e6c (diff) | |
download | qt-creator-1cf1700d1ca076298bf9095e2547490aa662e80a.tar.gz |
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>
Diffstat (limited to 'src/plugins/coreplugin/fileiconprovider.cpp')
-rw-r--r-- | src/plugins/coreplugin/fileiconprovider.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/fileiconprovider.cpp b/src/plugins/coreplugin/fileiconprovider.cpp index 4d6cf5ea48..e5606097cd 100644 --- a/src/plugins/coreplugin/fileiconprovider.cpp +++ b/src/plugins/coreplugin/fileiconprovider.cpp @@ -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 |