- Extending Qt Creator Manual
- FileIconProvider Namespace
- Extending Qt Creator Manual 8.0.2

# FileIconProvider Namespace

Core::FileIconProvider

Provides functions for registering custom overlay icons for system icons. More...

Header: | #include <FileIconProvider>

## Functions

QIcon | icon(const Utils::FilePath &filePath)
QIcon | icon(QFileIconProvider::IconType type)
QPixmap | overlayIcon(const QPixmap &baseIcon, const QIcon &overlayIcon)
QPixmap | overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlay, const QSize &size)
void | registerIconOverlayForMimeType(const QIcon &icon, const QString &mimeType)
void | registerIconOverlayForMimeType(const QString &path, const QString &mimeType)
void | registerIconOverlayForSuffix(const QString &path, const QString &suffix)

## Detailed Description

Provides icons based on file suffixes with the ability to overwrite system icons for specific subtypes. The underlying QFileIconProvider can be used for QFileSystemModel.

Note: Registering overlay icons currently completely replaces the system icon and is therefore not recommended on platforms that have their own overlay icon handling (macOS and Windows).

Plugins can register custom overlay icons via registerIconOverlayForSuffix(), and retrieve icons via the icon() function.

## Function Documentation

### QIcon FileIconProvider::icon(const Utils::FilePath &filePath)

Returns the icon associated with the file suffix in filePath. If there is none, the default icon of the operating system is returned.

### QIcon FileIconProvider::icon(QFileIconProvider::IconType type)

This is an overloaded function.

### QPixmap FileIconProvider::overlayIcon(const QPixmap &baseIcon, const QIcon &overlayIcon)

Creates a pixmap with baseIcon and lays overlayIcon over it.

### QPixmap FileIconProvider::overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlay, const QSize &size)

Creates a pixmap with baseIcon at size and overlay.

### void FileIconProvider::registerIconOverlayForMimeType(const QIcon &icon, const QString &mimeType)

Registers icon for all the suffixes of a the mime type mimeType, overlaying the system file icon.

### void FileIconProvider::registerIconOverlayForMimeType(const QString &path, const QString &mimeType)

This is an overloaded function.

### void FileIconProvider::registerIconOverlayForSuffix(const QString &path, const QString &suffix)

Registers an icon at path for a given suffix, overlaying the system file icon.