7#include <private/qqmldata_p.h>
8#include <private/qqmlengine_p.h>
11#include <QtCore/qcoreevent.h>
12#include <QtCore/qcoreapplication.h>
13#include <QtCore/qdebug.h>
18QQmlListModelWorkerAgent::Sync::~Sync()
23: m_ref(1), m_orig(model), m_copy(
new QQmlListModel(model,
this))
36 return m_copy->m_engine;
41 if (eng != m_copy->m_engine) {
42 m_copy->m_engine = eng;
43 emit engineChanged(eng);
54 bool del = !m_ref.deref();
67 return m_copy->count();
92 return m_copy->get(index);
97 m_copy->set(index, value);
102 m_copy->setProperty(index, property, value);
107 m_copy->move(from, to, count);
112 Sync *s =
new Sync(m_copy);
115 QCoreApplication::postEvent(
this, s);
116 syncDone.wait(&mutex);
122 if (e->type() == QEvent::User) {
124 QMutexLocker locker(&mutex);
126 Sync *s =
static_cast<Sync *>(e);
128 cc = (m_orig->count() != s->list->count());
130 Q_ASSERT(m_orig->m_dynamicRoles == s->list->m_dynamicRoles);
131 if (m_orig->m_dynamicRoles)
132 QQmlListModel::sync(s->list, m_orig);
141 emit m_orig->countChanged();
145 return QObject::event(e);
150#include "moc_qqmllistmodelworkeragent_p.cpp"
static bool sync(ListModel *src, ListModel *target)
bool event(QEvent *) override
This virtual function receives events to an object and should return true if the event e was recogniz...
Q_INVOKABLE void move(int from, int to, int count)
Q_INVOKABLE void release()
Q_INVOKABLE void remove(QQmlV4FunctionPtr args)
Q_INVOKABLE void insert(QQmlV4FunctionPtr args)
Q_INVOKABLE void setProperty(int index, const QString &property, const QVariant &value)
Q_INVOKABLE void addref()
Q_INVOKABLE void append(QQmlV4FunctionPtr args)
~QQmlListModelWorkerAgent()
void setEngine(QV4::ExecutionEngine *eng)
QV4::ExecutionEngine * engine() const