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

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