- Qt 5.15
- Qt Widgets
- C++ Classes
- QFileIconProvider
- Qt 5.15.15 Reference Documentation

# QFileIconProvider Class

The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes. More...

Header: | #include <QFileIconProvider>
qmake: | QT += widgets

- List of all members, including inherited members

## Public Types

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

## Public Functions

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

## Detailed Description

## Member Type Documentation

### enum QFileIconProvider::IconType

Constant | Value
--- | ---
`QFileIconProvider::Computer` | `0`
`QFileIconProvider::Desktop` | `1`
`QFileIconProvider::Trashcan` | `2`
`QFileIconProvider::Network` | `3`
`QFileIconProvider::Drive` | `4`
`QFileIconProvider::Folder` | `5`
`QFileIconProvider::File` | `6`

### enum QFileIconProvider::Option
flags QFileIconProvider::Options

Constant | Value | Description
--- | --- | ---
`QFileIconProvider::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.

This enum was introduced or modified in Qt 5.2.

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

## Member Function Documentation

### QFileIconProvider::QFileIconProvider()

Constructs a file icon provider.

### `[virtual]` QFileIconProvider::~QFileIconProvider()

Destroys the file icon provider.

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

Returns an icon set for the given type.

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

Returns an icon for the file described by info.

### Options QFileIconProvider::options() const

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

This function was introduced in Qt 5.2.

See also setOptions().

### void QFileIconProvider::setOptions(Options options)

Sets options that affect the icon provider.

This function was introduced in Qt 5.2.

See also options().

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

Returns the type of the file described by info.