Public Types | Public Member Functions | Static Public Member Functions | List of all members
pqIconListModel Class Reference

pqIconListModel is a model for list of icons. More...

#include <pqIconListModel.h>

Inherits QAbstractListModel.

Public Types

enum  IconRoles { PathRole = Qt::UserRole + 1, OriginRole }
 

Public Member Functions

 pqIconListModel (QObject *parent)
 
 ~pqIconListModel () override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of icons. More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Reimplements parent class to return data handled by pqIconListModel. More...
 
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 Insert new rows. More...
 
void addIcons (const QFileInfoList &iconInfoList)
 Add a list of icons. More...
 
void addIcon (const QFileInfo &iconInfo)
 Add a single icon in the model. More...
 
void clearAll ()
 Clear the model: remove all icons items. More...
 

Static Public Member Functions

static QStringList getSupportedIconFormats ()
 Returns the list of file extensions that can be used for icons. More...
 
static QMap< QString, QString > getAvailableOrigins ()
 Returns available extensions as a map of {name: display name}. More...
 
static bool isUserDefined (const QModelIndex &index)
 Returns true if index matches a user defined icon. More...
 

Detailed Description

pqIconListModel is a model for list of icons.

Icons may have different origins like application resources or user directory. Supported file format are defined based on the file extension.

Definition at line 22 of file pqIconListModel.h.

Member Enumeration Documentation

◆ IconRoles

Enumerator
PathRole 
OriginRole 

Definition at line 31 of file pqIconListModel.h.

Constructor & Destructor Documentation

◆ pqIconListModel()

pqIconListModel::pqIconListModel ( QObject *  parent)

◆ ~pqIconListModel()

pqIconListModel::~pqIconListModel ( )
override

Member Function Documentation

◆ rowCount()

int pqIconListModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of icons.

◆ data()

QVariant pqIconListModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Reimplements parent class to return data handled by pqIconListModel.

◆ insertRows()

bool pqIconListModel::insertRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
override

Insert new rows.

◆ addIcons()

void pqIconListModel::addIcons ( const QFileInfoList iconInfoList)

Add a list of icons.

◆ addIcon()

void pqIconListModel::addIcon ( const QFileInfo &  iconInfo)

Add a single icon in the model.

◆ clearAll()

void pqIconListModel::clearAll ( )

Clear the model: remove all icons items.

◆ getSupportedIconFormats()

static QStringList pqIconListModel::getSupportedIconFormats ( )
inlinestatic

Returns the list of file extensions that can be used for icons.

Definition at line 71 of file pqIconListModel.h.

◆ getAvailableOrigins()

static QMap<QString, QString> pqIconListModel::getAvailableOrigins ( )
inlinestatic

Returns available extensions as a map of {name: display name}.

Definition at line 80 of file pqIconListModel.h.

◆ isUserDefined()

static bool pqIconListModel::isUserDefined ( const QModelIndex &  index)
static

Returns true if index matches a user defined icon.


The documentation for this class was generated from the following file: