Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlChangeSet Class Reference

The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set. More...

#include <qqmlchangeset_p.h>

+ Collaboration diagram for QQmlChangeSet:

Classes

struct  Change
 
struct  ChangeData
 
struct  MoveKey
 

Public Member Functions

 QQmlChangeSet ()
 Constructs an empty change set.
 
 QQmlChangeSet (const QQmlChangeSet &changeSet)
 Constructs a copy of a changeSet.
 
 ~QQmlChangeSet ()
 Destroys a change set.
 
QQmlChangeSetoperator= (const QQmlChangeSet &changeSet)
 Assigns the value of a changeSet to another.
 
const QVector< Change > & removes () const
 
const QVector< Change > & inserts () const
 
const QVector< Change > & changes () const
 
void insert (int index, int count)
 Appends a notification that count items were inserted at index.
 
void remove (int index, int count)
 Appends a notification that count items were removed at index.
 
void move (int from, int to, int count, int moveId)
 Appends a notification that count items were moved from one index to another.
 
void change (int index, int count)
 Appends a notification that count items were changed at index.
 
void insert (const QVector< Change > &inserts)
 Applies a list of inserts to a change set.
 
void remove (const QVector< Change > &removes, QVector< Change > *inserts=nullptr)
 Applies a list of removes to a change set.
 
void move (const QVector< Change > &removes, const QVector< Change > &inserts)
 Applies a combined list of removes and inserts to a change set.
 
void change (const QVector< Change > &changes)
 Applies a list of changes to a change set.
 
void apply (const QQmlChangeSet &changeSet)
 Applies the changes in a changeSet to another.
 
bool isEmpty () const
 
void clear ()
 
int difference () const
 

Related Symbols

(Note that these are not member symbols.)

QDebug operator<< (QDebug debug, const QQmlChangeSet &set)
 
QDebug operator<< (QDebug debug, const QQmlChangeSet::Change &change)
 

Detailed Description

The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set.

QQmlChangeSet can be used to record a series of notifications about items in an indexed list being inserted, removed, moved, and changed. Notifications in the set are re-ordered so that all notifications of a single type are grouped together and sorted in order of ascending index, with remove notifications preceding all others, followed by insert notification, and then change notifications.

Moves in a change set are represented by a remove notification paired with an insert notification by way of a shared unique moveId. Re-ordering may result in one or both of the paired notifications being divided, when this happens the offset member of the notification will indicate the relative offset of the divided notification from the beginning of the original.

Definition at line 25 of file qqmlchangeset_p.h.

Constructor & Destructor Documentation

◆ QQmlChangeSet() [1/2]

QQmlChangeSet::QQmlChangeSet ( )

Constructs an empty change set.

Definition at line 32 of file qqmlchangeset.cpp.

◆ QQmlChangeSet() [2/2]

QQmlChangeSet::QQmlChangeSet ( const QQmlChangeSet & changeSet)

Constructs a copy of a changeSet.

Definition at line 41 of file qqmlchangeset.cpp.

◆ ~QQmlChangeSet()

QQmlChangeSet::~QQmlChangeSet ( )

Destroys a change set.

Definition at line 53 of file qqmlchangeset.cpp.

Member Function Documentation

◆ apply()

void QQmlChangeSet::apply ( const QQmlChangeSet & changeSet)

Applies the changes in a changeSet to another.

Definition at line 122 of file qqmlchangeset.cpp.

References change(), i, insert(), and remove().

Referenced by QQuickItemViewChangeSet::applyBufferedChanges(), and QQuickItemViewChangeSet::applyChanges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change() [1/2]

void QQmlChangeSet::change ( const QVector< Change > & changes)

Applies a list of changes to a change set.

Definition at line 464 of file qqmlchangeset.cpp.

References change(), and changes().

+ Here is the call graph for this function:

◆ change() [2/2]

void QQmlChangeSet::change ( int index,
int count )

Appends a notification that count items were changed at index.

Definition at line 111 of file qqmlchangeset.cpp.

References change(), and changes().

Referenced by apply(), change(), change(), insert(), and QQmlObjectModelPrivate::replace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changes()

const QVector< Change > & QQmlChangeSet::changes ( ) const
inline

Definition at line 81 of file qqmlchangeset_p.h.

Referenced by QQuickItemViewPrivate::applyModelChanges(), change(), and change().

+ Here is the caller graph for this function:

◆ clear()

void QQmlChangeSet::clear ( )
inline

Definition at line 96 of file qqmlchangeset_p.h.

Referenced by QQmlDelegateModelGroupPrivate::emitModelUpdated(), and QQuickItemViewChangeSet::reset().

+ Here is the caller graph for this function:

◆ difference()

int QQmlChangeSet::difference ( ) const
inline

Definition at line 104 of file qqmlchangeset_p.h.

Referenced by QQmlInstantiatorPrivate::_q_modelUpdated(), QQmlDelegateModelGroupPrivate::emitChanges(), QQmlDelegateModelPrivate::emitModelUpdated(), QQmlPartsModel::emitModelUpdated(), QQmlDelegateModelPrivate::updateFilterGroup(), QQmlPartsModel::updateFilterGroup(), and QQmlPartsModel::updateFilterGroup().

+ Here is the caller graph for this function:

◆ insert() [1/2]

void QQmlChangeSet::insert ( const QVector< Change > & inserts)

Applies a list of inserts to a change set.

Definition at line 360 of file qqmlchangeset.cpp.

References change(), QQmlChangeSet::ChangeData::count, insert(), inserts(), and next.

+ Here is the call graph for this function:

◆ insert() [2/2]

void QQmlChangeSet::insert ( int index,
int count )

Appends a notification that count items were inserted at index.

Definition at line 74 of file qqmlchangeset.cpp.

References insert().

Referenced by apply(), insert(), insert(), QQmlObjectModelPrivate::insert(), move(), and move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inserts()

const QVector< Change > & QQmlChangeSet::inserts ( ) const
inline

Definition at line 80 of file qqmlchangeset_p.h.

Referenced by MutableModelIterator::MutableModelIterator(), QQmlInstantiatorPrivate::_q_modelUpdated(), QQuickItemViewChangeSet::applyChanges(), QQuickItemViewPrivate::applyModelChanges(), QQmlDelegateModelGroupPrivate::emitChanges(), insert(), move(), move(), and remove().

+ Here is the caller graph for this function:

◆ isEmpty()

bool QQmlChangeSet::isEmpty ( ) const
inline

Definition at line 94 of file qqmlchangeset_p.h.

Referenced by QQmlDelegateModelGroupPrivate::emitChanges(), QQuickItemViewChangeSet::hasPendingChanges(), QQmlPartsModel::updateFilterGroup(), and QQmlPartsModel::updateFilterGroup().

+ Here is the caller graph for this function:

◆ move() [1/2]

void QQmlChangeSet::move ( const QVector< Change > & removes,
const QVector< Change > & inserts )

Applies a combined list of removes and inserts to a change set.

This is equivalent calling \l remove() followed by \l insert() with the same lists.

Definition at line 452 of file qqmlchangeset.cpp.

References i, insert(), inserts(), remove(), and removes().

+ Here is the call graph for this function:

◆ move() [2/2]

void QQmlChangeSet::move ( int from,
int to,
int count,
int moveId )

Appends a notification that count items were moved from one index to another.

The moveId must be unique across the lifetime of the change set and any related change sets.

Definition at line 97 of file qqmlchangeset.cpp.

References insert(), inserts(), remove(), and removes().

Referenced by QQmlObjectModelPrivate::move(), QQmlDelegateModelPrivate::updateFilterGroup(), and QQmlPartsModel::updateFilterGroup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

QQmlChangeSet & QQmlChangeSet::operator= ( const QQmlChangeSet & changeSet)

Assigns the value of a changeSet to another.

Definition at line 61 of file qqmlchangeset.cpp.

◆ remove() [1/2]

void QQmlChangeSet::remove ( const QVector< Change > & removes,
QVector< Change > * inserts = nullptr )

Applies a list of removes to a change set.

If a remove contains a moveId then any intersecting insert in the set will replace the corresponding intersection in the optional inserts list.

Definition at line 139 of file qqmlchangeset.cpp.

References inserts(), remove(), and removes().

+ Here is the call graph for this function:

◆ remove() [2/2]

void QQmlChangeSet::remove ( int index,
int count )

Appends a notification that count items were removed at index.

Definition at line 83 of file qqmlchangeset.cpp.

References remove(), and removes().

Referenced by apply(), move(), move(), remove(), remove(), and QQmlObjectModelPrivate::remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removes()

const QVector< Change > & QQmlChangeSet::removes ( ) const
inline

Definition at line 79 of file qqmlchangeset_p.h.

Referenced by MutableModelIterator::MutableModelIterator(), QQmlInstantiatorPrivate::_q_modelUpdated(), QQuickItemViewChangeSet::applyChanges(), QQuickItemViewPrivate::applyModelChanges(), QQmlDelegateModelGroupPrivate::emitChanges(), move(), move(), remove(), and remove().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<() [1/2]

QDebug operator<< ( QDebug debug,
const QQmlChangeSet & set )
related

Prints the contents of a change set to the debug stream.

Definition at line 524 of file qqmlchangeset.cpp.

References debug, insert(), remove(), and set.

+ Here is the call graph for this function:

◆ operator<<() [2/2]

QDebug operator<< ( QDebug debug,
const QQmlChangeSet::Change & change )
related

Prints a change to the debug stream.

Definition at line 546 of file qqmlchangeset.cpp.

References QQmlChangeSet::ChangeData::count, debug, and QQmlChangeSet::ChangeData::index.


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