MeVisLab Toolbox Reference
ml::ModelIndex Class Reference

#include <mlAbstractItemModel.h>

Public Member Functions

 ModelIndex ()
 ModelIndex (const ModelIndex &other)
 ~ModelIndex ()
AbstractItemModelmodel () const
 get the model of this index (this will be NULL for invalid indices)
bool isValid () const
 return if this index is valid i.e. it points at an item in the model
void * userPtr () const
 access the internal user pointer (same as user value)
size_t userID () const
 access the internal user value (same as user pointer)
Variant getData (int attributeIndex) const
 convenience method, this calls model()->getData(this, attributeIndex);
const ModelIndexoperator= (const ModelIndex &index)
 explicit assignment operator (handles reference counting if necessary)
bool operator== (const ModelIndex &index) const
bool operator!= (const ModelIndex &index) const

Friends

class AbstractItemModel

Detailed Description

This class serves as an index into an AbstractItemModel. It can only be generated from the model and internally either contains a void pointer or a integer which must be used to point at the item referenced.

Definition at line 40 of file mlAbstractItemModel.h.

Constructor & Destructor Documentation

◆ ModelIndex() [1/2]

ml::ModelIndex::ModelIndex ( )
inline

The only public constructor creates an "invalid" model index, which represents the virtual/invisible root item in every model.

Definition at line 47 of file mlAbstractItemModel.h.

References _userID.

Referenced by AbstractItemModel, ModelIndex(), operator!=(), operator=(), and operator==().

◆ ModelIndex() [2/2]

ml::ModelIndex::ModelIndex ( const ModelIndex & other)

References ModelIndex().

◆ ~ModelIndex()

ml::ModelIndex::~ModelIndex ( )

Member Function Documentation

◆ getData()

Variant ml::ModelIndex::getData ( int attributeIndex) const

convenience method, this calls model()->getData(this, attributeIndex);

◆ isValid()

bool ml::ModelIndex::isValid ( ) const
inline

return if this index is valid i.e. it points at an item in the model

Definition at line 55 of file mlAbstractItemModel.h.

◆ model()

AbstractItemModel * ml::ModelIndex::model ( ) const
inline

get the model of this index (this will be NULL for invalid indices)

Definition at line 52 of file mlAbstractItemModel.h.

References AbstractItemModel.

Referenced by AbstractItemModel.

◆ operator!=()

bool ml::ModelIndex::operator!= ( const ModelIndex & index) const

References ModelIndex().

◆ operator=()

const ModelIndex & ml::ModelIndex::operator= ( const ModelIndex & index)

explicit assignment operator (handles reference counting if necessary)

References ModelIndex().

◆ operator==()

bool ml::ModelIndex::operator== ( const ModelIndex & index) const

References ModelIndex().

◆ userID()

size_t ml::ModelIndex::userID ( ) const
inline

access the internal user value (same as user pointer)

Definition at line 61 of file mlAbstractItemModel.h.

References _userID.

Referenced by AbstractItemModel.

◆ userPtr()

void * ml::ModelIndex::userPtr ( ) const
inline

access the internal user pointer (same as user value)

Definition at line 58 of file mlAbstractItemModel.h.

References _userPtr.

Referenced by AbstractItemModel.

◆ AbstractItemModel

friend class AbstractItemModel
friend

Definition at line 73 of file mlAbstractItemModel.h.

References AbstractItemModel, model(), ModelIndex(), userID(), and userPtr().

Referenced by AbstractItemModel, and model().

Member Data Documentation

◆ _userID

size_t ml::ModelIndex::_userID

Definition at line 80 of file mlAbstractItemModel.h.

Referenced by ModelIndex(), and userID().

◆ _userPtr

void* ml::ModelIndex::_userPtr

Definition at line 79 of file mlAbstractItemModel.h.

Referenced by userPtr().


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