Messagelib

modelinvariantrowmapper.h
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #ifndef MESSAGELIST_CORE_MODELINVARIANTROWMAPPER_H
10 #define MESSAGELIST_CORE_MODELINVARIANTROWMAPPER_H
11 
12 #include <QObject>
13 #include <QHash>
14 #include <QList>
15 
16 #include <core/modelinvariantindex.h>
17 
18 namespace MessageList {
19 namespace Core {
20 class ModelInvariantRowMapper;
21 class ModelInvariantRowMapperPrivate;
22 
75 {
76  friend class ModelInvariantIndex;
77 
78  Q_OBJECT
79 
80 public:
81  explicit ModelInvariantRowMapper();
82  ~ModelInvariantRowMapper() override;
83 
90  void setLazyUpdateChunkInterval(int chunkInterval);
91 
98  void setLazyUpdateIdleInterval(int idleInterval);
99 
109 
119  void createModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill);
120 
127 
135 
142  void modelRowsInserted(int modelIndexRowPosition, int count);
143 
158  QList< ModelInvariantIndex * > *modelRowsRemoved(int modelIndexRowPosition, int count);
159 
169  void modelReset();
170 
171 private:
172  ModelInvariantRowMapperPrivate *const d;
173 };
174 } // namespace Core
175 } // namespace MessageList
176 
177 #endif
void modelReset()
Call this function from your handlers of reset() and layoutChanged() AFTER you ve last accessed the m...
ModelInvariantIndex * modelIndexRowToModelInvariantIndex(int modelIndexRow)
Finds the existing ModelInvariantIndex that belongs to the specified CURRENT modelIndexRow.
This class is an optimizing helper for dealing with large flat QAbstractItemModel objects...
void setLazyUpdateChunkInterval(int chunkInterval)
Sets the maximum time we can spend inside a single lazy update step.
Q_OBJECTQ_OBJECT
void modelRowsInserted(int modelIndexRowPosition, int count)
Call this function when rows are inserted to the underlying model BEFORE scanning the model for the n...
void createModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill)
Binds a ModelInvariantIndex structure to the specified CURRENT modelIndexRow.
QList< ModelInvariantIndex * > * modelIndexRowRangeToModelInvariantIndexList(int startIndexRow, int count)
This basically applies modelIndexRowToModelInvariantIndex() to a range of elements.
void setLazyUpdateIdleInterval(int idleInterval)
Sets the idle time between two lazy updates in milliseconds.
int modelInvariantIndexToModelIndexRow(ModelInvariantIndex *invariant)
Maps a ModelInvariantIndex to the CURRENT associated row index in the model.
An invariant index that can be ALWAYS used to reference an item inside a QAbstractItemModel.
QList< ModelInvariantIndex * > * modelRowsRemoved(int modelIndexRowPosition, int count)
Call this function when rows are removed from the underlying model AFTER accessing the removed rows f...
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 23:19:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.