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
qquickrepeater_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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKREPEATER_P_H
6#define QQUICKREPEATER_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 "qquickitem.h"
20
21#include <private/qtquickglobal_p.h>
22#include <private/qqmldelegatemodel_p.h>
23
25
26QT_BEGIN_NAMESPACE
27
28class QQmlChangeSet;
29class QQmlComponent;
30
32class Q_QUICK_EXPORT QQuickRepeater : public QQuickItem
33{
34 Q_OBJECT
35
36 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
37 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
38 Q_PROPERTY(int count READ count NOTIFY countChanged)
39 Q_PROPERTY(QQmlDelegateModel::DelegateModelAccess delegateModelAccess READ delegateModelAccess
40 WRITE setDelegateModelAccess NOTIFY delegateModelAccessChanged REVISION(6, 10) FINAL)
41
42 Q_CLASSINFO("DefaultProperty", "delegate")
43 QML_NAMED_ELEMENT(Repeater)
44 QML_ADDED_IN_VERSION(2, 0)
45
46public:
47 QQuickRepeater(QQuickItem *parent=nullptr);
48 virtual ~QQuickRepeater();
49
50 QVariant model() const;
51 void setModel(const QVariant &);
52
53 QQmlComponent *delegate() const;
54 void setDelegate(QQmlComponent *);
55
56 int count() const;
57
58 Q_INVOKABLE QQuickItem *itemAt(int index) const;
59
60 QQmlDelegateModel::DelegateModelAccess delegateModelAccess() const;
61 void setDelegateModelAccess(QQmlDelegateModel::DelegateModelAccess delegateModelAccess);
62
63Q_SIGNALS:
64 void modelChanged();
65 void delegateChanged();
66 void countChanged();
67
68 void itemAdded(int index, QQuickItem *item);
69 void itemRemoved(int index, QQuickItem *item);
70
71 Q_REVISION(6, 10) void delegateModelAccessChanged();
72
73private:
74 void clear();
75 void regenerate();
76
77protected:
78 void componentComplete() override;
79 void itemChange(ItemChange change, const ItemChangeData &value) override;
80
81private Q_SLOTS:
82 void createdItem(int index, QObject *item);
83 void initItem(int, QObject *item);
84 void modelUpdated(const QQmlChangeSet &changeSet, bool reset);
85
86private:
87 Q_DISABLE_COPY(QQuickRepeater)
88 Q_DECLARE_PRIVATE(QQuickRepeater)
89};
90
91QT_END_NAMESPACE
92
93#endif // QQUICKREPEATER_P_H
QT_REQUIRE_CONFIG(thread)