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(QFileIconProvider::IconType type) const
virtual QIcon icon(const QFileInfo &info) const
QFileIconProvider::Options options() const
void setOptions(QFileIconProvider::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::Optionflags 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(QFileIconProvider::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.

QFileIconProvider::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(QFileIconProvider::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.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.14/qfileiconprovider.html