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
qqmllistmodelworkeragent_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKLISTMODELWORKERAGENT_P_H
5#define QQUICKLISTMODELWORKERAGENT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qtqmlmodelsglobal_p.h>
19
20#include <QEvent>
21#include <QMutex>
22#include <QWaitCondition>
23#include <QtQml/qqml.h>
24
25#include <private/qv4engine_p.h>
26
27QT_REQUIRE_CONFIG(qml_list_model);
28
30
31
32class QQmlListModel;
33
35{
37 Q_PROPERTY(int count READ count FINAL)
41
42public:
45
46 QV4::ExecutionEngine *engine() const;
47 void setEngine(QV4::ExecutionEngine *eng);
48
49 Q_INVOKABLE void addref();
50 Q_INVOKABLE void release();
51
52 int count() const;
53
54 Q_INVOKABLE void clear();
58 Q_INVOKABLE QJSValue get(int index) const;
59 Q_INVOKABLE void set(int index, const QJSValue &value);
60 Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value);
61 Q_INVOKABLE void move(int from, int to, int count);
62 Q_INVOKABLE void sync();
63
64 void modelDestroyed();
65
68
69protected:
70 bool event(QEvent *) override;
71
74 friend class QQmlListModel;
75
76 struct Sync : public QEvent {
77 Sync(QQmlListModel *l)
79 , list(l)
80 {}
81 ~Sync();
83 };
84
85 QAtomicInt m_ref;
86 QQmlListModel *m_orig;
87 QQmlListModel *m_copy;
88 QMutex mutex;
89 QWaitCondition syncDone;
90};
91
93
94#endif // QQUICKLISTMODELWORKERAGENT_P_H
95
\inmodule QtCore
Definition qatomic.h:112
\inmodule QtCore
Definition qcoreevent.h:45
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
QQmlV4ExecutionEnginePtr engine
void engineChanged(QQmlV4ExecutionEnginePtr engine)
Q_INVOKABLE void move(int from, int to, int count)
Q_INVOKABLE void remove(QQmlV4FunctionPtr args)
Q_INVOKABLE void insert(QQmlV4FunctionPtr args)
Q_INVOKABLE void append(QQmlV4FunctionPtr args)
void setEngine(QV4::ExecutionEngine *eng)
Q_INVOKABLE QJSValue get(int index) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLenum GLenum GLsizei count
struct _cl_event * event
#define QML_ANONYMOUS
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SIGNALS
const char property[13]
Definition qwizard.cpp:101
QList< int > list
[14]
QFuture< QSet< QChar > > set
[10]
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)
QJSValueList args