Krita Source Code Documentation
Loading...
Searching...
No Matches
KisModelIndexConverterBase Class Referenceabstract

#include <kis_model_index_converter_base.h>

+ Inheritance diagram for KisModelIndexConverterBase:

Public Member Functions

virtual KisNodeDummydummyFromIndex (QModelIndex index)=0
 
virtual KisNodeDummydummyFromRow (int row, QModelIndex parent)=0
 
virtual bool indexFromAddedDummy (KisNodeDummy *parentDummy, int index, const QString &newNodeMetaObjectType, QModelIndex &parentIndex, int &row)=0
 
virtual QModelIndex indexFromDummy (KisNodeDummy *dummy)=0
 
virtual int rowCount (QModelIndex parent)=0
 
virtual ~KisModelIndexConverterBase ()
 

Detailed Description

The base class for converting objects to/from QModelIndex used in KisNodeModel and KisNodeDummy used in KisDummiesFacadeBase (KisShapeController).

This is not a trivial task, because the indexing of nodes is reversed in KisNodeModel.

Definition at line 24 of file kis_model_index_converter_base.h.

Constructor & Destructor Documentation

◆ ~KisModelIndexConverterBase()

KisModelIndexConverterBase::~KisModelIndexConverterBase ( )
virtual

Definition at line 10 of file kis_model_index_converter_base.cpp.

11{
12}

Member Function Documentation

◆ dummyFromIndex()

virtual KisNodeDummy * KisModelIndexConverterBase::dummyFromIndex ( QModelIndex index)
pure virtual

Returns the dummy associated with the index WARNING: index must be valid

Note
cannot return null

Implemented in KisModelIndexConverter, and KisModelIndexConverterShowAll.

◆ dummyFromRow()

virtual KisNodeDummy * KisModelIndexConverterBase::dummyFromRow ( int row,
QModelIndex parent )
pure virtual

Returns the dummy staying in the specified row of a parent May return null in case of inconsistency

Implemented in KisModelIndexConverter, and KisModelIndexConverterShowAll.

◆ indexFromAddedDummy()

virtual bool KisModelIndexConverterBase::indexFromAddedDummy ( KisNodeDummy * parentDummy,
int index,
const QString & newNodeMetaObjectType,
QModelIndex & parentIndex,
int & row )
pure virtual

Calculates the parent and the position in the model for newly created dummy

Parameters
parentDummythe dummy parent
indexthe dummy index
newNodeMetaObjectTypeis a class name of a newly added node This name is got from Qt's meta object system so you must compare this value against a corresponding staticMetaObject object only. We do not pass a pointer to a real node to limit the access to real nodes.
parentIndexthe parent index
rowthe dummy row
Returns
whether the new dummy will be shown in the model

Implemented in KisModelIndexConverter, and KisModelIndexConverterShowAll.

◆ indexFromDummy()

virtual QModelIndex KisModelIndexConverterBase::indexFromDummy ( KisNodeDummy * dummy)
pure virtual

Returns the index corresponding to the position of the dummy in the model. Will return invalid index if the dummy should be hidden

Implemented in KisModelIndexConverter, and KisModelIndexConverterShowAll.

◆ rowCount()

virtual int KisModelIndexConverterBase::rowCount ( QModelIndex parent)
pure virtual

Returns the number of children of the given index of the model

Implemented in KisModelIndexConverter, and KisModelIndexConverterShowAll.


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