- Qt 6.8
- Qt GUI
- C++ Classes
- QAbstractFileIconProvider
- Qt 6.8.3 Reference Documentation

# QAbstractFileIconProvider Class

The QAbstractFileIconProvider class provides file icons for the QFileSystemModel class. More...

Header: | `#include <QAbstractFileIconProvider>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Gui)` `target_link_libraries(mytarget PRIVATE Qt6::Gui)`
qmake: | `QT += gui`
Since: | Qt 6.0
Inherited By: | QFileIconProvider

- List of all members, including inherited members

## Public Types

enum | IconType { Computer, Desktop, Trashcan, Network, Drive, …, File }
enum | Option { DontUseCustomDirectoryIcons }
flags | Options

## Public Functions

| QAbstractFileIconProvider()
virtual | ~QAbstractFileIconProvider()
virtual QIcon | icon(QAbstractFileIconProvider::IconType type) const
virtual QIcon | icon(const QFileInfo &info) const
virtual QAbstractFileIconProvider::Options | options() const
virtual void | setOptions(QAbstractFileIconProvider::Options options)
virtual QString | type(const QFileInfo &info) const

## Detailed Description

## Member Type Documentation

### enum QAbstractFileIconProvider::IconType

Constant | Value | Description
--- | --- | ---
`QAbstractFileIconProvider::Computer` | `0` | The icon used for the computing device as a whole
`QAbstractFileIconProvider::Desktop` | `1` | The icon for the special "Desktop" directory of the user
`QAbstractFileIconProvider::Trashcan` | `2` | The icon for the user's "Trash" place in the desktop's file manager
`QAbstractFileIconProvider::Network` | `3` | The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network
`QAbstractFileIconProvider::Drive` | `4` | The icon used for disk drives
`QAbstractFileIconProvider::Folder` | `5` | The standard folder icon used to represent directories on local filesystems
`QAbstractFileIconProvider::File` | `6` | The icon used for generic text file types

### enum QAbstractFileIconProvider::Option
flags QAbstractFileIconProvider::Options

Constant | Value | Description
--- | --- | ---
`QAbstractFileIconProvider::DontUseCustomDirectoryIcons` | `0x00000001` | Always use the default directory icon. Some platforms allow the user to set a different icon. Custom icon lookup cause a big performance impact over network or removable drives.

The Options type is a typedef for QFlags<Option>. It stores an OR combination of Option values.

## Member Function Documentation

### QAbstractFileIconProvider::QAbstractFileIconProvider()

Constructs a file icon provider.

### `[virtual noexcept]` QAbstractFileIconProvider::~QAbstractFileIconProvider()

Destroys the file icon provider.

### `[virtual]` QIcon QAbstractFileIconProvider::icon(QAbstractFileIconProvider::IconType type) const

Returns an icon set for the given type, using the current icon theme.

See also QIcon::fromTheme.

### `[virtual]` QIcon QAbstractFileIconProvider::icon(const QFileInfo &info) const

Returns an icon for the file described by info, using the current icon theme.

See also QIcon::fromTheme.

### `[virtual]` QAbstractFileIconProvider::Options QAbstractFileIconProvider::options() const

Returns all the options that affect the icon provider. By default, all options are disabled.

See also setOptions().

### `[virtual]` void QAbstractFileIconProvider::setOptions(QAbstractFileIconProvider::Options options)

Sets options that affect the icon provider.

See also options().

### `[virtual]` QString QAbstractFileIconProvider::type(const QFileInfo &info) const

Returns the type of the file described by info.