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
qquickflickable_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 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 QQUICKFLICKABLE_P_H
5#define QQUICKFLICKABLE_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.h"
19#include <private/qtquickglobal_p.h>
20
22
25class Q_QUICK_EXPORT QQuickFlickable : public QQuickItem
26{
28
29 Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged)
30 Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged)
31 Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged)
32 Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged)
33 Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT)
34
35 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
36 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
37 Q_PROPERTY(qreal originY READ originY NOTIFY originYChanged)
38
39 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
40 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
41 Q_PROPERTY(qreal originX READ originX NOTIFY originXChanged)
42
43 Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged)
44 Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged)
45
46 Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged)
47 Q_PROPERTY(BoundsMovement boundsMovement READ boundsMovement WRITE setBoundsMovement NOTIFY boundsMovementChanged REVISION(2, 10))
48 Q_PROPERTY(QQuickTransition *rebound READ rebound WRITE setRebound NOTIFY reboundChanged)
49 Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
50 Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
51 Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
52 Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged)
53 Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged)
54 Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
55 Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged)
56 Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged)
57 Q_PROPERTY(bool dragging READ isDragging NOTIFY draggingChanged)
58 Q_PROPERTY(bool draggingHorizontally READ isDraggingHorizontally NOTIFY draggingHorizontallyChanged)
59 Q_PROPERTY(bool draggingVertically READ isDraggingVertically NOTIFY draggingVerticallyChanged)
60 Q_PROPERTY(FlickableDirection flickableDirection READ flickableDirection WRITE setFlickableDirection NOTIFY flickableDirectionChanged)
61
62 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged)
63 Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged)
64
65 Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY atXEndChanged)
66 Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY atYEndChanged)
67 Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY atXBeginningChanged)
68 Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY atYBeginningChanged)
69
70 Q_PROPERTY(QQuickFlickableVisibleArea *visibleArea READ visibleArea CONSTANT)
71
72 Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY pixelAlignedChanged)
73 Q_PROPERTY(bool synchronousDrag READ synchronousDrag WRITE setSynchronousDrag NOTIFY synchronousDragChanged REVISION(2, 12))
74
75 Q_PROPERTY(qreal horizontalOvershoot READ horizontalOvershoot NOTIFY horizontalOvershootChanged REVISION(2, 9))
76 Q_PROPERTY(qreal verticalOvershoot READ verticalOvershoot NOTIFY verticalOvershootChanged REVISION(2, 9))
77
78 Q_PROPERTY(QQmlListProperty<QObject> flickableData READ flickableData)
79 Q_PROPERTY(QQmlListProperty<QQuickItem> flickableChildren READ flickableChildren)
80 Q_CLASSINFO("DefaultProperty", "flickableData")
81 QML_NAMED_ELEMENT(Flickable)
83
84public:
85 QQuickFlickable(QQuickItem *parent=nullptr);
86 ~QQuickFlickable() override;
87
88 QQmlListProperty<QObject> flickableData();
89 QQmlListProperty<QQuickItem> flickableChildren();
90
92 StopAtBounds = 0x0,
93 DragOverBounds = 0x1,
94 OvershootBounds = 0x2,
95 DragAndOvershootBounds = DragOverBounds | OvershootBounds
96 };
97 Q_DECLARE_FLAGS(BoundsBehavior, BoundsBehaviorFlag)
98 Q_FLAG(BoundsBehavior)
99
100 BoundsBehavior boundsBehavior() const;
101 void setBoundsBehavior(BoundsBehavior);
102
104 // StopAtBounds = 0x0,
105 FollowBoundsBehavior = 0x1
106 };
107 Q_ENUM(BoundsMovement)
108
109 BoundsMovement boundsMovement() const;
110 void setBoundsMovement(BoundsMovement movement);
111
112 QQuickTransition *rebound() const;
113 void setRebound(QQuickTransition *transition);
114
115 qreal contentWidth() const;
116 void setContentWidth(qreal);
117
118 qreal contentHeight() const;
119 void setContentHeight(qreal);
120
121 qreal contentX() const;
122 virtual void setContentX(qreal pos);
123
124 qreal contentY() const;
125 virtual void setContentY(qreal pos);
126
127 qreal topMargin() const;
128 void setTopMargin(qreal m);
129
130 qreal bottomMargin() const;
131 void setBottomMargin(qreal m);
132
133 qreal leftMargin() const;
134 void setLeftMargin(qreal m);
135
136 qreal rightMargin() const;
137 void setRightMargin(qreal m);
138
139 virtual qreal originY() const;
140 virtual qreal originX() const;
141
142 bool isMoving() const;
143 bool isMovingHorizontally() const;
144 bool isMovingVertically() const;
145 bool isFlicking() const;
146 bool isFlickingHorizontally() const;
147 bool isFlickingVertically() const;
148 bool isDragging() const;
149 bool isDraggingHorizontally() const;
150 bool isDraggingVertically() const;
151
152 int pressDelay() const;
153 void setPressDelay(int delay);
154
155 qreal maximumFlickVelocity() const;
156 void setMaximumFlickVelocity(qreal);
157
158 qreal flickDeceleration() const;
159 void setFlickDeceleration(qreal);
160
161 bool isInteractive() const;
162 void setInteractive(bool);
163
164 qreal horizontalVelocity() const;
165 qreal verticalVelocity() const;
166
167 bool isAtXEnd() const;
168 bool isAtXBeginning() const;
169 bool isAtYEnd() const;
170 bool isAtYBeginning() const;
171
172 QQuickItem *contentItem() const;
173
174 enum FlickableDirection { AutoFlickDirection=0x0, HorizontalFlick=0x1, VerticalFlick=0x2, HorizontalAndVerticalFlick=0x3,
175 AutoFlickIfNeeded=0xc };
176 Q_ENUM(FlickableDirection)
177 FlickableDirection flickableDirection() const;
178 void setFlickableDirection(FlickableDirection);
179
180 bool pixelAligned() const;
181 void setPixelAligned(bool align);
182
183 bool synchronousDrag() const;
184 void setSynchronousDrag(bool v);
185
186 qreal horizontalOvershoot() const;
187 qreal verticalOvershoot() const;
188
189 Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center);
190 Q_INVOKABLE void returnToBounds();
191 Q_INVOKABLE void flick(qreal xVelocity, qreal yVelocity);
192 Q_INVOKABLE void cancelFlick();
193
220 Q_REVISION(2, 10) void boundsMovementChanged();
221 void reboundChanged();
222 void maximumFlickVelocityChanged();
223 void flickDecelerationChanged();
224 void pressDelayChanged();
225 void movementStarted();
226 void movementEnded();
227 void flickStarted();
228 void flickEnded();
229 void dragStarted();
230 void dragEnded();
231 void pixelAlignedChanged();
232 Q_REVISION(2, 12) void synchronousDragChanged();
233 Q_REVISION(2, 9) void horizontalOvershootChanged();
234 Q_REVISION(2, 9) void verticalOvershootChanged();
235
236 // The next four signals should be marked as Q_REVISION(2, 12). See QTBUG-71243
237 void atXEndChanged();
238 void atYEndChanged();
239 void atXBeginningChanged();
240 void atYBeginningChanged();
241
242protected:
243 bool childMouseEventFilter(QQuickItem *, QEvent *) override;
244 void mousePressEvent(QMouseEvent *event) override;
245 void mouseMoveEvent(QMouseEvent *event) override;
246 void mouseReleaseEvent(QMouseEvent *event) override;
247 void touchEvent(QTouchEvent *event) override;
248#if QT_CONFIG(wheelevent)
249 void wheelEvent(QWheelEvent *event) override;
250#endif
251 void timerEvent(QTimerEvent *event) override;
252
254
255protected Q_SLOTS:
256 void movementStarting();
257 void movementEnding();
258 void movementEnding(bool hMovementEnding, bool vMovementEnding);
259 void velocityTimelineCompleted();
260 void timelineCompleted();
261
262protected:
263 virtual qreal minXExtent() const;
264 virtual qreal minYExtent() const;
265 virtual qreal maxXExtent() const;
266 virtual qreal maxYExtent() const;
267 qreal vWidth() const;
268 qreal vHeight() const;
269 void componentComplete() override;
270 virtual void viewportMoved(Qt::Orientations orient);
271 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
272 void mouseUngrabEvent() override;
273 bool filterPointerEvent(QQuickItem *receiver, QPointerEvent *event);
274
275 bool xflick() const;
276 bool yflick() const;
277
278protected:
280
281private:
282 Q_DISABLE_COPY(QQuickFlickable)
283 Q_DECLARE_PRIVATE(QQuickFlickable)
286};
287
289
290#endif // QQUICKFLICKABLE_P_H
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
A base class for pointer events.
Definition qevent.h:73
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
void contentXChanged()
void flickingChanged()
void boundsBehaviorChanged()
void originYChanged()
void draggingHorizontallyChanged()
void movingChanged()
void leftMarginChanged()
void topMarginChanged()
void interactiveChanged()
void flickableDirectionChanged()
Q_REVISION(2, 10) void boundsMovementChanged()
void bottomMarginChanged()
void contentYChanged()
void movingHorizontallyChanged()
void draggingChanged()
QQuickFlickableVisibleArea * visibleArea()
void flickingVerticallyChanged()
void verticalVelocityChanged()
void isAtBoundaryChanged()
void draggingVerticallyChanged()
void horizontalVelocityChanged()
void contentWidthChanged()
void movingVerticallyChanged()
void rightMarginChanged()
void flickingHorizontallyChanged()
void contentHeightChanged()
void originXChanged()
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 qcoreevent.h:366
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
GLsizei const GLfloat * v
[13]
const GLfloat * m
GLfloat GLfloat GLfloat w
[0]
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_FLAG(x)
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187