Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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

(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 26 of file qqmlchangeset_p.h.

Constructor & Destructor Documentation

◆ QQmlChangeSet() [1/2]

QQmlChangeSet::QQmlChangeSet ( )

Constructs an empty change set.

Definition at line 33 of file qqmlchangeset.cpp.

◆ QQmlChangeSet() [2/2]

QQmlChangeSet::QQmlChangeSet ( const QQmlChangeSet & changeSet)

Constructs a copy of a changeSet.

Definition at line 42 of file qqmlchangeset.cpp.

◆ ~QQmlChangeSet()

QQmlChangeSet::~QQmlChangeSet ( )

Destroys a change set.

Definition at line 54 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 123 of file qqmlchangeset.cpp.

◆ change() [1/2]

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

Applies a list of changes to a change set.

Definition at line 465 of file qqmlchangeset.cpp.

◆ change() [2/2]

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

Appends a notification that count items were changed at index.

Definition at line 112 of file qqmlchangeset.cpp.

◆ changes()

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

Definition at line 82 of file qqmlchangeset_p.h.

◆ clear()

void QQmlChangeSet::clear ( )
inline

Definition at line 97 of file qqmlchangeset_p.h.

◆ difference()

int QQmlChangeSet::difference ( ) const
inline

Definition at line 105 of file qqmlchangeset_p.h.

◆ insert() [1/2]

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

Applies a list of inserts to a change set.

Definition at line 361 of file qqmlchangeset.cpp.

◆ insert() [2/2]

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

Appends a notification that count items were inserted at index.

Definition at line 75 of file qqmlchangeset.cpp.

◆ inserts()

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

Definition at line 81 of file qqmlchangeset_p.h.

◆ isEmpty()

bool QQmlChangeSet::isEmpty ( ) const
inline

Definition at line 95 of file qqmlchangeset_p.h.

◆ 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 453 of file qqmlchangeset.cpp.

◆ 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 98 of file qqmlchangeset.cpp.

◆ operator=()

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

Assigns the value of a changeSet to another.

Definition at line 62 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 140 of file qqmlchangeset.cpp.

◆ remove() [2/2]

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

Appends a notification that count items were removed at index.

Definition at line 84 of file qqmlchangeset.cpp.

◆ removes()

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

Definition at line 80 of file qqmlchangeset_p.h.

◆ 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 525 of file qqmlchangeset.cpp.

◆ operator<<() [2/2]

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

Prints a change to the debug stream.

Definition at line 547 of file qqmlchangeset.cpp.


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