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

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

ConstantValueDescription
QAbstractFileIconProvider::Computer0The icon used for the computing device as a whole
QAbstractFileIconProvider::Desktop1The icon for the special "Desktop" directory of the user
QAbstractFileIconProvider::Trashcan2The icon for the user's "Trash" place in the desktop's file manager
QAbstractFileIconProvider::Network3The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network
QAbstractFileIconProvider::Drive4The icon used for disk drives
QAbstractFileIconProvider::Folder5The standard folder icon used to represent directories on local filesystems
QAbstractFileIconProvider::File6The icon used for generic text file types

enum QAbstractFileIconProvider::Option
flags QAbstractFileIconProvider::Options

ConstantValueDescription
QAbstractFileIconProvider::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.

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.