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 QQUICKPACKAGE_H
5#define QQUICKPACKAGE_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 <qqml.h>
19#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
20
21QT_REQUIRE_CONFIG(qml_delegate_model);
22
23QT_BEGIN_NAMESPACE
24
25class QQuickPackagePrivate;
26class QQuickPackageAttached;
27class Q_QMLMODELS_PRIVATE_EXPORT QQuickPackage : public QObject
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QQuickPackage)
31
32 Q_CLASSINFO("DefaultProperty", "data")
33 QML_NAMED_ELEMENT(Package)
34 QML_ADDED_IN_VERSION(2, 0)
35 QML_ATTACHED(QQuickPackageAttached)
36 Q_PROPERTY(QQmlListProperty<QObject> data READ data)
37
38public:
39 QQuickPackage(QObject *parent=nullptr);
40
41 QQmlListProperty<QObject> data();
42
43 QObject *part(const QString & = QString());
44 bool hasPart(const QString &);
45
46 static QQuickPackageAttached *qmlAttachedProperties(QObject *);
47};
48
49class QQuickPackageAttached : public QObject
50{
51Q_OBJECT
52Q_PROPERTY(QString name READ name WRITE setName FINAL)
53public:
54 QQuickPackageAttached(QObject *parent);
55 virtual ~QQuickPackageAttached();
56
57 QString name() const;
58 void setName(const QString &n);
59
60 static QHash<QObject *, QQuickPackageAttached *> attached;
61private:
62 QString _name;
63};
64
65QT_END_NAMESPACE
66
67QML_DECLARE_TYPE(QQuickPackage)
68
69#endif // QQUICKPACKAGE_H
70

source code of qtdeclarative/src/qmlmodels/qquickpackage_p.h