QFileIconProvider Class

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

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

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

ConstantValue
QFileIconProvider::Computer0
QFileIconProvider::Desktop1
QFileIconProvider::Trashcan2
QFileIconProvider::Network3
QFileIconProvider::Drive4
QFileIconProvider::Folder5
QFileIconProvider::File6

enum QFileIconProvider::Option
flags QFileIconProvider::Options

ConstantValueDescription
QFileIconProvider::DontUseCustomDirectoryIcons0x00000001Always 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.