messagelist
modelinvariantrowmapper.cpp
Go to the documentation of this file.
52 for ( QHash< int, ModelInvariantIndex * >::ConstIterator it = mInvariantHash->constBegin(); it != end; ++it )
86 for ( QHash< int, ModelInvariantIndex * >::ConstIterator it = d->mCurrentInvariantHash->constBegin(); it != end; ++it )
150 void ModelInvariantRowMapperPrivate::updateModelInvariantIndex( int modelIndexRow, ModelInvariantIndex * invariantToFill )
182 ModelInvariantIndex * ModelInvariantRowMapperPrivate::modelIndexRowToModelInvariantIndexInternal( int modelIndexRow, bool updateIfNeeded )
252 int ModelInvariantRowMapper::modelInvariantIndexToModelIndexRow( ModelInvariantIndex * invariant )
265 return invariant->d->modelIndexRow(); // this invariant was emitted very recently and isn't affected by any change
291 // The serial is equal to the current serial and we return the row index unchanged still with serial 1
297 // The serial is equal to the current serial and we return the row index unchanged still with serial 1
307 // The serial is equal to the current serial and we return the row index unchanged still with serial 2
344 void ModelInvariantRowMapper::createModelInvariantIndex( int modelIndexRow, ModelInvariantIndex * invariantToFill )
350 invariantToFill->d->setModelIndexRowAndRowMapperSerial( modelIndexRow, d->mCurrentShiftSerial );
358 ModelInvariantIndex *ModelInvariantRowMapper::modelIndexRowToModelInvariantIndex( int modelIndexRow )
363 QList< ModelInvariantIndex * > * ModelInvariantRowMapper::modelIndexRowRangeToModelInvariantIndexList( int startIndexRow, int count )
418 // Check if we can attach to the last existing shift (very common for consecutive row additions)
459 QList< ModelInvariantIndex * > * ModelInvariantRowMapper::modelRowsRemoved( int modelIndexRowPosition, int count )
511 ModelInvariantIndex * dyingInvariant = d->modelIndexRowToModelInvariantIndexInternal( idx, false );
542 RowShift * shift = new RowShift( modelIndexRowPosition + count, -count, d->mCurrentInvariantHash );
578 // FIXME: optimize this (it probably can be optimized by providing a more complex user interface)
581 for ( QHash< int, ModelInvariantIndex * >::ConstIterator it = d->mCurrentInvariantHash->constBegin(); it != end; ++it )
QList< RowShift * > * mRowShiftList
The ordered list of RowShifts, most recent at the end.
Definition: modelinvariantrowmapper_p.h:70
void modelReset()
Call this function from your handlers of reset() and layoutChanged() AFTER you ve last accessed the m...
Definition: modelinvariantrowmapper.cpp:576
void slotPerformLazyUpdate()
Internal: Performs a lazy update step.
Definition: modelinvariantrowmapper.cpp:598
virtual ~ModelInvariantRowMapper()
Definition: modelinvariantrowmapper.cpp:79
int mLazyUpdateIdleInterval
Msecs: how much time we idle between lazy update chunks.
Definition: modelinvariantrowmapper_p.h:75
uint mCurrentShiftSerial
Current model change serial: FIXME: it explodes at 2^32 :D.
Definition: modelinvariantrowmapper_p.h:72
void killFirstRowShift()
Internal: Removes the first RowShift from the list.
Definition: modelinvariantrowmapper.cpp:101
ModelInvariantIndex * modelIndexRowToModelInvariantIndex(int modelIndexRow)
Finds the existing ModelInvariantIndex that belongs to the specified CURRENT modelIndexRow.
Definition: modelinvariantrowmapper.cpp:358
void updateModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill)
Internal.
Definition: modelinvariantrowmapper.cpp:150
ModelInvariantRowMapper *const q
Definition: modelinvariantrowmapper_p.h:68
void indexDead(ModelInvariantIndex *index)
This is called from the ModelInvariantIndex destructor.
Definition: modelinvariantrowmapper.cpp:117
void setLazyUpdateChunkInterval(int chunkInterval)
Sets the maximum time we can spend inside a single lazy update step.
Definition: modelinvariantrowmapper.cpp:242
ModelInvariantRowMapper * rowMapper() const
Definition: modelinvariantindex_p.h:45
int modelIndexRow() const
Definition: modelinvariantindex_p.h:39
void modelRowsInserted(int modelIndexRowPosition, int count)
Call this function when rows are inserted to the underlying model BEFORE scanning the model for the n...
Definition: modelinvariantrowmapper.cpp:393
ModelInvariantIndex * modelIndexRowToModelInvariantIndexInternal(int modelIndexRow, bool updateIfNeeded)
Internal.
Definition: modelinvariantrowmapper.cpp:182
int mLazyUpdateChunkInterval
Msecs: how much time we spend inside a lazy update chunk.
Definition: modelinvariantrowmapper_p.h:74
uint rowMapperSerial() const
Definition: modelinvariantindex_p.h:41
void createModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill)
Binds a ModelInvariantIndex structure to the specified CURRENT modelIndexRow.
Definition: modelinvariantrowmapper.cpp:344
QHash< int, ModelInvariantIndex * > * mCurrentInvariantHash
The up-to-date invariants.
Definition: modelinvariantrowmapper_p.h:71
uint mRemovedShiftCount
The number of shifts that we have completely processed.
Definition: modelinvariantrowmapper_p.h:73
QList< ModelInvariantIndex * > * modelIndexRowRangeToModelInvariantIndexList(int startIndexRow, int count)
This basically applies modelIndexRowToModelInvariantIndex() to a range of elements.
Definition: modelinvariantrowmapper.cpp:363
void setLazyUpdateIdleInterval(int idleInterval)
Sets the idle time between two lazy updates in milliseconds.
Definition: modelinvariantrowmapper.cpp:247
int modelInvariantIndexToModelIndexRow(ModelInvariantIndex *invariant)
Maps a ModelInvariantIndex to the CURRENT associated row index in the model.
Definition: modelinvariantrowmapper.cpp:252
An invariant index that can be ALWAYS used to reference an item inside a QAbstractItemModel.
Definition: modelinvariantindex.h:44
void setModelIndexRowAndRowMapperSerial(int modelIndexRow, uint rowMapperSerial)
Definition: modelinvariantindex_p.h:43
void setRowMapper(ModelInvariantRowMapper *mapper)
Definition: modelinvariantindex_p.h:47
ModelInvariantRowMapper()
Definition: modelinvariantrowmapper.cpp:64
QList< ModelInvariantIndex * > * modelRowsRemoved(int modelIndexRowPosition, int count)
Call this function when rows are removed from the underlying model AFTER accessing the removed rows f...
Definition: modelinvariantrowmapper.cpp:459
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.