1// Copyright (C) 2017 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 QQUICKTUMBLERVIEW_P_H
5#define QQUICKTUMBLERVIEW_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 <QQuickItem>
19#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQuickListView;
24class QQuickPath;
25class QQuickPathView;
26
27class QQuickTumbler;
28
29class Q_QUICKCONTROLS2IMPL_PRIVATE_EXPORT QQuickTumblerView : public QQuickItem
30{
31 Q_OBJECT
32 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
33 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
34 Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged)
35 QML_NAMED_ELEMENT(TumblerView)
36 QML_ADDED_IN_VERSION(2, 1)
37
38public:
39 QQuickTumblerView(QQuickItem *parent = nullptr);
40
41 QVariant model() const;
42 void setModel(const QVariant &model);
43
44 QQmlComponent *delegate() const;
45 void setDelegate(QQmlComponent *delegate);
46
47 QQuickPath *path() const;
48 void setPath(QQuickPath *path);
49
50Q_SIGNALS:
51 void modelChanged();
52 void delegateChanged();
53 void pathChanged();
54
55protected:
56 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
57 void componentComplete() override;
58 void itemChange(ItemChange change, const ItemChangeData &data) override;
59
60private:
61 QQuickItem *view();
62 void createView();
63 void updateView();
64 void updateModel();
65
66 void wrapChange();
67
68 QQuickTumbler *m_tumbler = nullptr;
69 QVariant m_model;
70 QQmlComponent *m_delegate = nullptr;
71 QQuickPathView *m_pathView = nullptr;
72 QQuickListView *m_listView = nullptr;
73 QQuickPath *m_path = nullptr;
74};
75
76QT_END_NAMESPACE
77
78#endif // TUMBLERVIEW_H
79

source code of qtdeclarative/src/quickcontrolsimpl/qquicktumblerview_p.h