Qt 4.8
Public Functions | Public Variables | List of all members
QAbstractItemModelPrivate::Persistent Struct Reference

#include <qabstractitemmodel_p.h>

Public Functions

void insertMultiAtEnd (const QModelIndex &key, QPersistentModelIndexData *data)
 QHash::insertMulti insert the value before the old value. More...
 
 Persistent ()
 

Public Variables

QHash< QModelIndex, QPersistentModelIndexData * > indexes
 
QStack< QVector< QPersistentModelIndexData * > > invalidated
 
QStack< QVector< QPersistentModelIndexData * > > moved
 

Detailed Description

Definition at line 160 of file qabstractitemmodel_p.h.

Constructors and Destructors

◆ Persistent()

QAbstractItemModelPrivate::Persistent::Persistent ( )
inline

Definition at line 161 of file qabstractitemmodel_p.h.

161 {}

Functions

◆ insertMultiAtEnd()

void QAbstractItemModelPrivate::Persistent::insertMultiAtEnd ( const QModelIndex key,
QPersistentModelIndexData data 
)

QHash::insertMulti insert the value before the old value.

Warning
This function is not part of the public interface. and find() return the new value. We need insertMultiAtEnd because we don't want to overwrite the old one, which should be removed later

There should be only one instance QPersistentModelIndexData per index, but in some intermediate state there may be severals of PersistantModelIndex pointing to the same index, but one is already updated, and the other one is not. This make sure than when updating the first one we don't overwrite the second one in the hash, and the second one will be updated right later.

Definition at line 3698 of file qabstractitemmodel.cpp.

3699 {
3701  indexes.insertMulti(key, data);
3703  while (it != indexes.end() && it.key() == key) {
3704  qSwap(*newIt,*it);
3705  newIt = it;
3706  ++it;
3707  }
3708 }
#define it(className, varName)
QHash< QModelIndex, QPersistentModelIndexData * > indexes
const Key & key() const
Returns the current item&#39;s key as a const reference.
Definition: qhash.h:347
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
int key
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
Definition: qhash.h:330
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:772

Properties

◆ indexes

QHash<QModelIndex, QPersistentModelIndexData *> QAbstractItemModelPrivate::Persistent::indexes

Definition at line 162 of file qabstractitemmodel_p.h.

◆ invalidated

QStack<QVector<QPersistentModelIndexData *> > QAbstractItemModelPrivate::Persistent::invalidated

Definition at line 164 of file qabstractitemmodel_p.h.

◆ moved

QStack<QVector<QPersistentModelIndexData *> > QAbstractItemModelPrivate::Persistent::moved

Definition at line 163 of file qabstractitemmodel_p.h.


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