MessageList::Core::ModelInvariantIndex

Search for usage in LXR

MessageList::Core::ModelInvariantIndex Class Reference

#include <modelinvariantindex.h>

Inheritance diagram for MessageList::Core::ModelInvariantIndex:

Public Member Functions

int currentModelIndexRow ()
 
bool isValid () const
 

Detailed Description

An invariant index that can be ALWAYS used to reference an item inside a QAbstractItemModel.

This class is meant to be used together with ModelInvariantRowMapper.

Definition at line 27 of file modelinvariantindex.h.

Constructor & Destructor Documentation

◆ ModelInvariantIndex()

ModelInvariantIndex::ModelInvariantIndex ( )
explicit

Definition at line 16 of file modelinvariantindex.cpp.

◆ ~ModelInvariantIndex()

ModelInvariantIndex::~ModelInvariantIndex ( )
virtual

Definition at line 21 of file modelinvariantindex.cpp.

Member Function Documentation

◆ currentModelIndexRow()

int ModelInvariantIndex::currentModelIndexRow ( )
nodiscard

Returns the current model index row for this invariant index.

This function calls the mapper and asks it to perform the persistent mapping. If this index isn't valid then the returned value is -1.

If you actually own the row mapper then you may save some clock cycles by calling the modelInvariantIndexToModelIndexRow() by your own. If you don't own the mapper then this function is the only way to go.

Definition at line 33 of file modelinvariantindex.cpp.

◆ isValid()

bool ModelInvariantIndex::isValid ( ) const
nodiscard

Returns true if this ModelInvariantIndex is valid, that is, it has been attached to a ModelInvariantRowMapper.

Returns false otherwise. An invalid index will always map to the current row -1 (which is invalid as QModelIndex row).

Definition at line 28 of file modelinvariantindex.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:53:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.