1// Copyright (C) 2019 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 QQMLABSTRACTDELEGATECOMPONENT_P_H
5#define QQMLABSTRACTDELEGATECOMPONENT_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 <private/qtqmlmodelsglobal_p.h>
19#include <private/qqmlcomponentattached_p.h>
20#include <qqmlcomponent.h>
21
22QT_REQUIRE_CONFIG(qml_delegate_model);
23
24QT_BEGIN_NAMESPACE
25
26// TODO: consider making QQmlAbstractDelegateComponent public API
27class QQmlAdaptorModel;
28class Q_QMLMODELS_PRIVATE_EXPORT QQmlAbstractDelegateComponent : public QQmlComponent
29{
30 Q_OBJECT
31 QML_NAMED_ELEMENT(AbstractDelegateComponent)
32 QML_ADDED_IN_VERSION(2, 0)
33 QML_UNCREATABLE("Cannot create instance of abstract class AbstractDelegateComponent.")
34
35public:
36 QQmlAbstractDelegateComponent(QObject *parent = nullptr);
37 ~QQmlAbstractDelegateComponent() override;
38
39 virtual QQmlComponent *delegate(QQmlAdaptorModel *adaptorModel, int row, int column = 0) const = 0;
40
41Q_SIGNALS:
42 void delegateChanged();
43
44protected:
45 QVariant value(QQmlAdaptorModel *adaptorModel,int row, int column, const QString &role) const;
46};
47
48QT_END_NAMESPACE
49
50#endif // QQMLABSTRACTDELEGATECOMPONENT_P_H
51

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