forked from qt-creator/qt-creator
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:
@@ -43,7 +43,6 @@
|
||||
#include <QtDebug>
|
||||
#include <QDir>
|
||||
#include <QIcon>
|
||||
#include <QStyle>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -51,19 +50,6 @@ using namespace ProjectExplorer;
|
||||
// Helpers:
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
static QIcon generateIcon(const QString &overlay)
|
||||
{
|
||||
const QSize desiredSize = QSize(16, 16);
|
||||
const QIcon overlayIcon(overlay);
|
||||
const QPixmap pixmap
|
||||
= Core::FileIconProvider::overlayIcon(QStyle::SP_DirIcon, overlayIcon, desiredSize);
|
||||
|
||||
QIcon result;
|
||||
result.addPixmap(pixmap);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -375,7 +361,7 @@ QbsProductNode::QbsProductNode(const qbs::ProductData &prd) :
|
||||
QbsBaseProjectNode(Utils::FileName::fromString(prd.location().filePath())),
|
||||
m_qbsProductData(prd)
|
||||
{
|
||||
static QIcon productIcon = generateIcon(QString(Constants::QBS_PRODUCT_OVERLAY_ICON));
|
||||
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
||||
setIcon(productIcon);
|
||||
}
|
||||
|
||||
@@ -468,7 +454,7 @@ QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurations() c
|
||||
QbsProjectNode::QbsProjectNode(const Utils::FileName &projectDirectory) :
|
||||
QbsBaseProjectNode(projectDirectory)
|
||||
{
|
||||
static QIcon projectIcon = generateIcon(QString(ProjectExplorer::Constants::FILEOVERLAY_QT));
|
||||
static QIcon projectIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
||||
setIcon(projectIcon);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user