5#ifndef QQMLCHANGESET_P_H
6#define QQMLCHANGESET_P_H
19#include <QtQmlIntegration/qqmlintegration.h>
20#include <QtCore/qdebug.h>
21#include <QtCore/qvector.h>
22#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
34 MoveKey(
int moveId,
int offset) : moveId(moveId), offset(offset) {}
50 struct Change: ChangeData
58 Change(
int index,
int count,
int moveId = -1,
int offset = 0) {
61 this->moveId = moveId;
62 this->offset = offset;
65 bool isMove()
const {
return moveId >= 0; }
67 MoveKey moveKey(
int index)
const {
68 return MoveKey(moveId, index - Change::index + offset); }
70 int start()
const {
return index; }
71 int end()
const {
return index + count; }
75 QQmlChangeSet(
const QQmlChangeSet &changeSet);
78 QQmlChangeSet &operator =(
const QQmlChangeSet &changeSet);
80 const QList<Change> &removes()
const {
return m_removes; }
81 const QList<Change> &inserts()
const {
return m_inserts; }
82 const QList<Change> &changes()
const {
return m_changes; }
84 void insert(
int index,
int count);
85 void remove(
int index,
int count);
86 void move(
int from,
int to,
int count,
int moveId);
87 void change(
int index,
int count);
89 void insert(
const QList<Change> &inserts);
90 void remove(
const QList<Change> &removes, QList<Change> *inserts =
nullptr);
91 void move(
const QList<Change> &removes,
const QList<Change> &inserts);
92 void change(
const QList<Change> &changes);
93 void apply(
const QQmlChangeSet &changeSet);
95 bool isEmpty()
const {
return m_removes.empty() && m_inserts.empty() && m_changes.isEmpty(); }
105 int difference()
const {
return m_difference; }
108 void remove(QList<Change> *removes, QList<Change> *inserts);
109 void change(QList<Change> *changes);
111 QList<Change> m_removes;
112 QList<Change> m_inserts;
113 QList<Change> m_changes;
117Q_DECLARE_TYPEINFO(QQmlChangeSet::Change, Q_PRIMITIVE_TYPE);
118Q_DECLARE_TYPEINFO(QQmlChangeSet::MoveKey, Q_PRIMITIVE_TYPE);
120inline size_t qHash(
const QQmlChangeSet::MoveKey &key) {
return qHash(std::make_pair(key.moveId, key.offset)); }
121inline bool operator ==(
const QQmlChangeSet::MoveKey &l,
const QQmlChangeSet::MoveKey &r) {
122 return l.moveId == r.moveId && l.offset == r.offset; }
124Q_QMLMODELS_EXPORT
QDebug operator <<(QDebug debug,
const QQmlChangeSet::Change &change);
125Q_QMLMODELS_EXPORT
QDebug operator <<(QDebug debug,
const QQmlChangeSet &change);
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set.
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
size_t qHash(const QHashedString &string)