QQmlChangeSet Class
The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set. \internal
. More...
Header: | #include <QQmlChangeSet> |
Public Functions
QQmlChangeSet() | |
QQmlChangeSet(const QQmlChangeSet &changeSet) | |
~QQmlChangeSet() | |
void | apply(const QQmlChangeSet &changeSet) |
void | change(int index, int count) |
void | change(const QVector<Change> &changes) |
void | insert(int index, int count) |
void | insert(const QVector<Change> &inserts) |
void | move(int from, int to, int count, int moveId) |
void | move(const QVector<Change> &removes, const QVector<Change> &inserts) |
void | remove(int index, int count) |
void | remove(const QVector<Change> &removes, QVector<Change> *inserts = nullptr) |
QQmlChangeSet & | operator=(const QQmlChangeSet &changeSet) |
Related Non-Members
QDebug | operator<<(QDebug debug, const QQmlChangeSet &set) |
QDebug | operator<<(QDebug debug, const QQmlChangeSet::Change &change) |
Detailed Description
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.
Member Function Documentation
QQmlChangeSet::QQmlChangeSet()
Constructs an empty change set.
QQmlChangeSet::QQmlChangeSet(const QQmlChangeSet &changeSet)
Constructs a copy of a changeSet.
[noexcept]
QQmlChangeSet::~QQmlChangeSet()
Destroys a change set.
void QQmlChangeSet::apply(const QQmlChangeSet &changeSet)
Applies the changes in a changeSet to another.
void QQmlChangeSet::change(int index, int count)
Appends a notification that count items were changed at index.
void QQmlChangeSet::change(const QVector<Change> &changes)
Applies a list of changes to a change set.
void QQmlChangeSet::insert(int index, int count)
Appends a notification that count items were inserted at index.
void QQmlChangeSet::insert(const QVector<Change> &inserts)
Applies a list of inserts to a change set.
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.
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 remove() followed by insert() with the same lists.
void QQmlChangeSet::remove(int index, int count)
Appends a notification that count items were removed at index.
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.
QQmlChangeSet &QQmlChangeSet::operator=(const QQmlChangeSet &changeSet)
Assigns the value of a changeSet to another.
Related Non-Members
QDebug operator<<(QDebug debug, const QQmlChangeSet &set)
\internal
Prints the contents of a change set to the debug stream.
QDebug operator<<(QDebug debug, const QQmlChangeSet::Change &change)
\internal
Prints a change to the debug stream.