Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaintOpListModel Class Reference

#include <kis_paint_ops_model.h>

+ Inheritance diagram for KisPaintOpListModel:

Public Member Functions

QVariant data (const QModelIndex &idx, int role=Qt::DisplayRole) const override
 
void fill (const QList< KisPaintOpFactory * > &list)
 
 KisPaintOpListModel (QObject *parent)
 
- Public Member Functions inherited from KisCategorizedListModel< TEntry, TEntryToQStringConverter >
SpecificCategoriesMappercategoriesMapper ()
 
const SpecificCategoriesMappercategoriesMapper () const
 
QVariant data (const QModelIndex &idx, int role=Qt::DisplayRole) const override
 
bool entryAt (TEntry &entry, QModelIndex index) const
 
Qt::ItemFlags flags (const QModelIndex &idx) const override
 
QModelIndex indexOf (const TEntry &entry) const
 
 KisCategorizedListModel (QObject *parent=0)
 
int rowCount (const QModelIndex &parent) const override
 
bool setData (const QModelIndex &idx, const QVariant &value, int role=Qt::EditRole) override
 
- Public Member Functions inherited from __CategorizedListModelBase
 __CategorizedListModelBase (QObject *parent)
 
 ~__CategorizedListModelBase () override
 

Additional Inherited Members

- Public Types inherited from KisCategorizedListModel< TEntry, TEntryToQStringConverter >
typedef SpecificCategoriesMapper::DataItem DataItem
 
typedef TEntry Entry_Type
 
typedef KisCategoriesMapper< TEntry, TEntryToQStringConverter > SpecificCategoriesMapper
 
- Public Types inherited from __CategorizedListModelBase
enum  AdditionalRoles {
  IsHeaderRole = Qt::UserRole + 1 , ExpandCategoryRole = Qt::UserRole + 2 , SortRole = Qt::UserRole + 3 , isLockedRole = Qt::UserRole + 4 ,
  isLockableRole = Qt::UserRole + 5 , isToggledRole = Qt::UserRole + 6
}
 

Detailed Description

Definition at line 48 of file kis_paint_ops_model.h.

Constructor & Destructor Documentation

◆ KisPaintOpListModel()

KisPaintOpListModel::KisPaintOpListModel ( QObject * parent)

Definition at line 18 of file kis_paint_ops_model.cpp.

20{
21}
KisCategorizedListModel< KisPaintOpInfo, PaintOpInfoToQStringConverter > BasePaintOpCategorizedListModel

Member Function Documentation

◆ data()

QVariant KisPaintOpListModel::data ( const QModelIndex & idx,
int role = Qt::DisplayRole ) const
override

Definition at line 23 of file kis_paint_ops_model.cpp.

24{
25 if (!idx.isValid()) return QVariant();
26
27 DataItem *item = categoriesMapper()->itemFromRow(idx.row());
28 Q_ASSERT(item);
29
30 if(role == Qt::DecorationRole) {
31 if (!item->isCategory()) {
32 return item->data()->icon;
33 }
34 } else if (role == SortRole) {
35 return item->isCategory() ? item->name() :
36 QString("%1%2%3")
37 .arg(item->parentCategory()->name())
38 .arg(item->data()->priority, 4)
39 .arg(item->name());
40 }
41
43}
DataItem * itemFromRow(int row) const
QVariant data(const QModelIndex &idx, int role=Qt::DisplayRole) const override
SpecificCategoriesMapper::DataItem DataItem
SpecificCategoriesMapper * categoriesMapper()

References KisCategorizedListModel< TEntry, TEntryToQStringConverter >::categoriesMapper(), KisCategoriesMapper< TEntry, TEntryToQStringConverter >::DataItem::data(), KisCategorizedListModel< TEntry, TEntryToQStringConverter >::data(), KisCategoriesMapper< TEntry, TEntryToQStringConverter >::DataItem::isCategory(), KisCategoriesMapper< TEntry, TEntryToQStringConverter >::itemFromRow(), KisCategoriesMapper< TEntry, TEntryToQStringConverter >::DataItem::name(), KisCategoriesMapper< TEntry, TEntryToQStringConverter >::DataItem::parentCategory(), and __CategorizedListModelBase::SortRole.

◆ fill()


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