Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktumblerview_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKTUMBLERVIEW_P_H
6#define QQUICKTUMBLERVIEW_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QQuickItem>
20#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
21#include <QtCore/qvariant.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickListView;
26class QQuickPath;
27class QQuickPathView;
28class QQmlComponent;
29
30class QQuickTumbler;
31
32class Q_QUICKCONTROLS2IMPL_EXPORT QQuickTumblerView : public QQuickItem
33{
34 Q_OBJECT
35 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
36 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
37 Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged)
38 QML_NAMED_ELEMENT(TumblerView)
39 QML_ADDED_IN_VERSION(2, 1)
40
41public:
42 QQuickTumblerView(QQuickItem *parent = nullptr);
43
44 QVariant model() const;
45 void setModel(const QVariant &model);
46
47 QQmlComponent *delegate() const;
48 void setDelegate(QQmlComponent *delegate);
49
50 QQuickPath *path() const;
51 void setPath(QQuickPath *path);
52
53Q_SIGNALS:
54 void modelChanged();
55 void delegateChanged();
56 void pathChanged();
57
58protected:
59 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
60 void componentComplete() override;
61 void itemChange(ItemChange change, const ItemChangeData &data) override;
62
63private:
64 QQuickItem *view();
65 void createView();
66 void updateFlickDeceleration();
67 void updateView();
68 void updateModel();
69
70 void wrapChange();
71
72 QQuickTumbler *m_tumbler = nullptr;
73 QVariant m_model;
74 QQmlComponent *m_delegate = nullptr;
75 QQuickPathView *m_pathView = nullptr;
76 QQuickListView *m_listView = nullptr;
77 QQuickPath *m_path = nullptr;
78};
79
80QT_END_NAMESPACE
81
82#endif // TUMBLERVIEW_H