Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicktumbler_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
4#ifndef QQUICKTUMBLER_P_H
5#define QQUICKTUMBLER_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 <QtCore/qvariant.h>
19#include <QtQml/qqmlcomponent.h>
20#include <QtQuickTemplates2/private/qquickcontrol_p.h>
21
23
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickTumbler : public QQuickControl
28{
30 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
31 Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
32 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
33 Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
34 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
35 Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL)
36 // 2.1 (Qt 5.8)
37 Q_PROPERTY(bool wrap READ wrap WRITE setWrap RESET resetWrap NOTIFY wrapChanged FINAL REVISION(2, 1))
38 // 2.2 (Qt 5.9)
39 Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged FINAL REVISION(2, 2))
40 QML_NAMED_ELEMENT(Tumbler)
43
44public:
45 explicit QQuickTumbler(QQuickItem *parent = nullptr);
47
48 QVariant model() const;
49 void setModel(const QVariant &model);
50
51 int count() const;
52
53 int currentIndex() const;
54 void setCurrentIndex(int currentIndex);
55 QQuickItem *currentItem() const;
56
57 QQmlComponent *delegate() const;
58 void setDelegate(QQmlComponent *delegate);
59
60 int visibleItemCount() const;
61 void setVisibleItemCount(int visibleItemCount);
62
63 static QQuickTumblerAttached *qmlAttachedProperties(QObject *object);
64
65 // 2.1 (Qt 5.8)
66 bool wrap() const;
67 void setWrap(bool wrap);
68 void resetWrap();
69
70 // 2.2 (Qt 5.9)
71 bool isMoving() const;
72
77 Visible, // ListView-only
79 SnapPosition
80 };
81 Q_ENUM(PositionMode)
82
83 // 2.5 (Qt 5.12)
84 Q_REVISION(2, 5) Q_INVOKABLE void positionViewAtIndex(int index, PositionMode mode);
85
87 void modelChanged();
88 void countChanged();
89 void currentIndexChanged();
90 void currentItemChanged();
91 void delegateChanged();
92 void visibleItemCountChanged();
93 // 2.1 (Qt 5.8)
94 Q_REVISION(2, 1) void wrapChanged();
95 // 2.2 (Qt 5.9)
96 Q_REVISION(2, 2) void movingChanged();
97
98protected:
99 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
100 void componentComplete() override;
101 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
102 void keyPressEvent(QKeyEvent *event) override;
103 void updatePolish() override;
104
105 QFont defaultFont() const override;
106
107private:
108 Q_DISABLE_COPY(QQuickTumbler)
109 Q_DECLARE_PRIVATE(QQuickTumbler)
110
111 Q_PRIVATE_SLOT(d_func(), void _q_updateItemWidths())
112 Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
113 Q_PRIVATE_SLOT(d_func(), void _q_onViewCurrentIndexChanged())
114 Q_PRIVATE_SLOT(d_func(), void _q_onViewCountChanged())
115 Q_PRIVATE_SLOT(d_func(), void _q_onViewOffsetChanged())
116 Q_PRIVATE_SLOT(d_func(), void _q_onViewContentYChanged())
117};
118
120
121class Q_QUICKTEMPLATES2_EXPORT QQuickTumblerAttached : public QObject
122{
124 Q_PROPERTY(QQuickTumbler *tumbler READ tumbler CONSTANT FINAL)
125 Q_PROPERTY(qreal displacement READ displacement NOTIFY displacementChanged FINAL)
126
127public:
128 explicit QQuickTumblerAttached(QObject *parent = nullptr);
129
130 QQuickTumbler *tumbler() const;
131 qreal displacement() const;
132
134 void displacementChanged();
135
136private:
137 Q_DISABLE_COPY(QQuickTumblerAttached)
138 Q_DECLARE_PRIVATE(QQuickTumblerAttached)
139};
140
142
143#endif // QQUICKTUMBLER_P_H
\reentrant
Definition qfont.h:22
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
GLenum mode
GLuint index
[2]
GLenum GLenum GLsizei count
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QML_ATTACHED(ATTACHED_TYPE)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_INVOKABLE
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
view setModel(model)
[17] //! [18]
QSqlQueryModel * model
[16]