FileIconProvider Namespace

Core::FileIconProvider

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

Header: #include <FileIconProvider>

Functions

QIcon icon(const QFileInfo &info)
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 QFileInfo &info)

Returns the icon associated with the file suffix in info. 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.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.