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
qqmlinstantiator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Research In Motion.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QQMLINSTANTIATOR_P_H
6#define QQMLINSTANTIATOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQml/qqmlcomponent.h>
20#include <QtQml/qqmlparserstatus.h>
21
22#include <private/qqmldelegatemodel_p.h>
23#include <private/qtqmlmodelsglobal_p.h>
24
26
27QT_BEGIN_NAMESPACE
28
29class QQmlInstantiatorPrivate;
30class Q_QMLMODELS_EXPORT QQmlInstantiator : public QObject, public QQmlParserStatus
31{
32 Q_OBJECT
33 Q_INTERFACES(QQmlParserStatus)
34
35 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
36 Q_PROPERTY(bool asynchronous READ isAsync WRITE setAsync NOTIFY asynchronousChanged)
37 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
40 Q_PROPERTY(QObject *object READ object NOTIFY objectChanged)
41 Q_PROPERTY(QQmlDelegateModel::DelegateModelAccess delegateModelAccess READ delegateModelAccess
42 WRITE setDelegateModelAccess NOTIFY delegateModelAccessChanged REVISION(6, 10) FINAL)
43 Q_CLASSINFO("DefaultProperty", "delegate")
44 QML_NAMED_ELEMENT(Instantiator)
45 QML_ADDED_IN_VERSION(2, 1)
46
47public:
48 QQmlInstantiator(QObject *parent = nullptr);
49 ~QQmlInstantiator();
50
51 bool isActive() const;
52 void setActive(bool newVal);
53
54 bool isAsync() const;
55 void setAsync(bool newVal);
56
57 int count() const;
58
59 QQmlComponent* delegate();
60 void setDelegate(QQmlComponent* c);
61
62 QVariant model() const;
63 void setModel(const QVariant &v);
64
65 QQmlDelegateModel::DelegateModelAccess delegateModelAccess() const;
66 void setDelegateModelAccess(QQmlDelegateModel::DelegateModelAccess delegateModelAccess);
67
68 QObject *object() const;
69
70 Q_INVOKABLE QObject *objectAt(int index) const;
71
72 void classBegin() override;
73 void componentComplete() override;
74
75Q_SIGNALS:
76 void modelChanged();
77 void delegateChanged();
78 void countChanged();
79 void objectChanged();
80 void activeChanged();
81 void asynchronousChanged();
82
83 void objectAdded(int index, QObject* object);
84 void objectRemoved(int index, QObject* object);
85
86 Q_REVISION(6, 10) void delegateModelAccessChanged();
87
88private:
89 Q_DISABLE_COPY(QQmlInstantiator)
90 Q_DECLARE_PRIVATE(QQmlInstantiator)
91 Q_PRIVATE_SLOT(d_func(), void _q_createdItem(int, QObject *))
92 Q_PRIVATE_SLOT(d_func(), void _q_modelUpdated(const QQmlChangeSet &, bool))
93};
94
95QT_END_NAMESPACE
96
97#endif // QQMLCREATOR_P_H
QT_REQUIRE_CONFIG(qml_delegate_model)