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 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class QQuickListView; |
24 | class QQuickPath; |
25 | class QQuickPathView; |
26 | |
27 | class QQuickTumbler; |
28 | |
29 | class 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 | |
38 | public: |
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 | |
50 | Q_SIGNALS: |
51 | void modelChanged(); |
52 | void delegateChanged(); |
53 | void pathChanged(); |
54 | |
55 | protected: |
56 | void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
57 | void componentComplete() override; |
58 | void itemChange(ItemChange change, const ItemChangeData &data) override; |
59 | |
60 | private: |
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 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // TUMBLERVIEW_H |
79 |