Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickflickable_p_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | const qreal MinimumFlickVelocity = 75.0; | - | ||||||
7 | - | |||||||
8 | class QQuickFlickableVisibleArea; | - | ||||||
9 | class QQuickTransition; | - | ||||||
10 | class QQuickFlickableReboundTransition; | - | ||||||
11 | - | |||||||
12 | class __attribute__((visibility("default"))) QQuickFlickablePrivate : public QQuickItemPrivate, public QQuickItemChangeListener | - | ||||||
13 | { | - | ||||||
14 | inline QQuickFlickable* q_func() { return static_cast<QQuickFlickable *>(q_ptr); } inline const QQuickFlickable* q_func() const { return static_cast<const QQuickFlickable *>(q_ptr); } friend class QQuickFlickable; | - | ||||||
15 | - | |||||||
16 | public: | - | ||||||
17 | static inline QQuickFlickablePrivate *get(QQuickFlickable *o) { return executed 4803 times by 3 tests: o->d_func();return o->d_func(); Executed by:
executed 4803 times by 3 tests: }return o->d_func(); Executed by:
| 4803 | ||||||
18 | - | |||||||
19 | QQuickFlickablePrivate(); | - | ||||||
20 | void init(); | - | ||||||
21 | - | |||||||
22 | struct Velocity : public QQuickTimeLineValue | - | ||||||
23 | { | - | ||||||
24 | Velocity(QQuickFlickablePrivate *p) | - | ||||||
25 | : parent(p) {} executed 8200 times by 18 tests: end of block Executed by:
| 8200 | ||||||
26 | void setValue(qreal v) override { | - | ||||||
27 | if (v != value()
| 8224-20773 | ||||||
28 | QQuickTimeLineValue::setValue(v); | - | ||||||
29 | parent->updateVelocity(); | - | ||||||
30 | } executed 20773 times by 8 tests: end of block Executed by:
| 20773 | ||||||
31 | } executed 28997 times by 9 tests: end of block Executed by:
| 28997 | ||||||
32 | QQuickFlickablePrivate *parent; | - | ||||||
33 | }; | - | ||||||
34 | - | |||||||
35 | struct AxisData { | - | ||||||
36 | AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal)) | - | ||||||
37 | : move(fp, func) | - | ||||||
38 | , transitionToBounds(nullptr) | - | ||||||
39 | , viewSize(-1), lastPos(0), previousDragDelta(0), velocity(0), startMargin(0), endMargin(0) | - | ||||||
40 | , origin(0), overshoot(0) | - | ||||||
41 | , transitionTo(0) | - | ||||||
42 | , continuousFlickVelocity(0), velocityTime(), vTime(0) | - | ||||||
43 | , smoothVelocity(fp), atEnd(false), atBeginning(true) | - | ||||||
44 | , transitionToSet(false) | - | ||||||
45 | , fixingUp(false), inOvershoot(false), inRebound(false), moving(false), flicking(false) | - | ||||||
46 | , dragging(false), extentsChanged(false) | - | ||||||
47 | , explicitValue(false), minExtentDirty(true), maxExtentDirty(true) | - | ||||||
48 | , unused(0) | - | ||||||
49 | {} executed 8200 times by 18 tests: end of block Executed by:
| 8200 | ||||||
50 | - | |||||||
51 | ~AxisData(); | - | ||||||
52 | - | |||||||
53 | void reset() { | - | ||||||
54 | velocityBuffer.clear(); | - | ||||||
55 | dragStartOffset = 0; | - | ||||||
56 | fixingUp = false; | - | ||||||
57 | inOvershoot = false; | - | ||||||
58 | } executed 2044 times by 7 tests: end of block Executed by:
| 2044 | ||||||
59 | - | |||||||
60 | void markExtentsDirty() { | - | ||||||
61 | minExtentDirty = true; | - | ||||||
62 | maxExtentDirty = true; | - | ||||||
63 | extentsChanged = true; | - | ||||||
64 | } executed 46950 times by 17 tests: end of block Executed by:
| 46950 | ||||||
65 | - | |||||||
66 | void resetTransitionTo() { | - | ||||||
67 | transitionTo = 0; | - | ||||||
68 | transitionToSet = false; | - | ||||||
69 | } never executed: end of block | 0 | ||||||
70 | - | |||||||
71 | void addVelocitySample(qreal v, qreal maxVelocity); | - | ||||||
72 | void updateVelocity(); | - | ||||||
73 | - | |||||||
74 | QQuickTimeLineValueProxy<QQuickFlickablePrivate> move; | - | ||||||
75 | QQuickFlickableReboundTransition *transitionToBounds; | - | ||||||
76 | qreal viewSize; | - | ||||||
77 | qreal pressPos; | - | ||||||
78 | qreal lastPos; | - | ||||||
79 | qreal dragStartOffset; | - | ||||||
80 | qreal dragMinBound; | - | ||||||
81 | qreal dragMaxBound; | - | ||||||
82 | qreal previousDragDelta; | - | ||||||
83 | qreal velocity; | - | ||||||
84 | qreal flickTarget; | - | ||||||
85 | qreal startMargin; | - | ||||||
86 | qreal endMargin; | - | ||||||
87 | qreal origin; | - | ||||||
88 | qreal overshoot; | - | ||||||
89 | qreal transitionTo; | - | ||||||
90 | qreal continuousFlickVelocity; | - | ||||||
91 | QElapsedTimer velocityTime; | - | ||||||
92 | int vTime; | - | ||||||
93 | QQuickFlickablePrivate::Velocity smoothVelocity; | - | ||||||
94 | QPODVector<qreal,10> velocityBuffer; | - | ||||||
95 | bool atEnd : 1; | - | ||||||
96 | bool atBeginning : 1; | - | ||||||
97 | bool transitionToSet : 1; | - | ||||||
98 | bool fixingUp : 1; | - | ||||||
99 | bool inOvershoot : 1; | - | ||||||
100 | bool inRebound : 1; | - | ||||||
101 | bool moving : 1; | - | ||||||
102 | bool flicking : 1; | - | ||||||
103 | bool dragging : 1; | - | ||||||
104 | bool extentsChanged : 1; | - | ||||||
105 | bool explicitValue : 1; | - | ||||||
106 | mutable bool minExtentDirty : 1; | - | ||||||
107 | mutable bool maxExtentDirty : 1; | - | ||||||
108 | uint unused : 19; | - | ||||||
109 | }; | - | ||||||
110 | - | |||||||
111 | bool flickX(qreal velocity); | - | ||||||
112 | bool flickY(qreal velocity); | - | ||||||
113 | virtual bool flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||
114 | QQuickTimeLineCallback::Callback fixupCallback, qreal velocity); | - | ||||||
115 | void flickingStarted(bool flickingH, bool flickingV); | - | ||||||
116 | - | |||||||
117 | void fixupX(); | - | ||||||
118 | void fixupY(); | - | ||||||
119 | virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent); | - | ||||||
120 | void adjustContentPos(AxisData &data, qreal toPos); | - | ||||||
121 | void resetTimeline(AxisData &data); | - | ||||||
122 | void clearTimeline(); | - | ||||||
123 | - | |||||||
124 | void updateBeginningEnd(); | - | ||||||
125 | - | |||||||
126 | bool isInnermostPressDelay(QQuickItem *item) const; | - | ||||||
127 | void captureDelayedPress(QQuickItem *item, QMouseEvent *event); | - | ||||||
128 | void clearDelayedPress(); | - | ||||||
129 | void replayDelayedPress(); | - | ||||||
130 | - | |||||||
131 | void setViewportX(qreal x); | - | ||||||
132 | void setViewportY(qreal y); | - | ||||||
133 | - | |||||||
134 | qreal overShootDistance(qreal size) const; | - | ||||||
135 | - | |||||||
136 | void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override; | - | ||||||
137 | - | |||||||
138 | void draggingStarting(); | - | ||||||
139 | void draggingEnding(); | - | ||||||
140 | - | |||||||
141 | bool isViewMoving() const; | - | ||||||
142 | - | |||||||
143 | void cancelInteraction(); | - | ||||||
144 | - | |||||||
145 | public: | - | ||||||
146 | QQuickItem *contentItem; | - | ||||||
147 | - | |||||||
148 | AxisData hData; | - | ||||||
149 | AxisData vData; | - | ||||||
150 | - | |||||||
151 | QQuickTimeLine timeline; | - | ||||||
152 | bool hMoved : 1; | - | ||||||
153 | bool vMoved : 1; | - | ||||||
154 | bool stealMouse : 1; | - | ||||||
155 | bool pressed : 1; | - | ||||||
156 | bool scrollingPhase : 1; | - | ||||||
157 | bool interactive : 1; | - | ||||||
158 | bool calcVelocity : 1; | - | ||||||
159 | bool pixelAligned : 1; | - | ||||||
160 | QElapsedTimer timer; | - | ||||||
161 | QBasicTimer movementEndingTimer; | - | ||||||
162 | qint64 lastPosTime; | - | ||||||
163 | qint64 lastPressTime; | - | ||||||
164 | QPointF lastPos; | - | ||||||
165 | QPointF pressPos; | - | ||||||
166 | QVector2D accumulatedWheelPixelDelta; | - | ||||||
167 | qreal deceleration; | - | ||||||
168 | qreal maxVelocity; | - | ||||||
169 | qreal reportedVelocitySmoothing; | - | ||||||
170 | QMouseEvent *delayedPressEvent; | - | ||||||
171 | QBasicTimer delayedPressTimer; | - | ||||||
172 | int pressDelay; | - | ||||||
173 | int fixupDuration; | - | ||||||
174 | qreal flickBoost; | - | ||||||
175 | - | |||||||
176 | enum FixupMode { Normal, Immediate, ExtentChanged }; | - | ||||||
177 | FixupMode fixupMode; | - | ||||||
178 | - | |||||||
179 | static void fixupY_callback(void *); | - | ||||||
180 | static void fixupX_callback(void *); | - | ||||||
181 | - | |||||||
182 | void updateVelocity(); | - | ||||||
183 | int vTime; | - | ||||||
184 | QQuickTimeLine velocityTimeline; | - | ||||||
185 | QQuickFlickableVisibleArea *visibleArea; | - | ||||||
186 | QQuickFlickable::FlickableDirection flickableDirection; | - | ||||||
187 | QQuickFlickable::BoundsBehavior boundsBehavior; | - | ||||||
188 | QQuickFlickable::BoundsMovement boundsMovement; | - | ||||||
189 | QQuickTransition *rebound; | - | ||||||
190 | - | |||||||
191 | void viewportAxisMoved(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||
192 | QQuickTimeLineCallback::Callback fixupCallback); | - | ||||||
193 | - | |||||||
194 | void handleMousePressEvent(QMouseEvent *); | - | ||||||
195 | void handleMouseMoveEvent(QMouseEvent *); | - | ||||||
196 | void handleMouseReleaseEvent(QMouseEvent *); | - | ||||||
197 | - | |||||||
198 | void maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn); | - | ||||||
199 | void drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos, | - | ||||||
200 | const QVector2D &deltas, bool overThreshold, bool momentum, | - | ||||||
201 | bool velocitySensitiveOverBounds, const QVector2D &velocity); | - | ||||||
202 | - | |||||||
203 | qint64 computeCurrentTime(QInputEvent *event) const; | - | ||||||
204 | qreal devicePixelRatio() const; | - | ||||||
205 | - | |||||||
206 | - | |||||||
207 | static void data_append(QQmlListProperty<QObject> *, QObject *); | - | ||||||
208 | static int data_count(QQmlListProperty<QObject> *); | - | ||||||
209 | static QObject *data_at(QQmlListProperty<QObject> *, int); | - | ||||||
210 | static void data_clear(QQmlListProperty<QObject> *); | - | ||||||
211 | }; | - | ||||||
212 | - | |||||||
213 | class QQuickFlickableVisibleArea : public QObject | - | ||||||
214 | { | - | ||||||
215 | public: | - | ||||||
216 | #pragma GCC diagnostic push | - | ||||||
217 | - | |||||||
218 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
219 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||
220 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
221 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
222 | #pragma GCC diagnostic pop | - | ||||||
223 | struct QPrivateSignal {}; | - | ||||||
224 | - | |||||||
225 | - | |||||||
226 | - | |||||||
227 | - | |||||||
228 | - | |||||||
229 | - | |||||||
230 | public: | - | ||||||
231 | QQuickFlickableVisibleArea(QQuickFlickable *parent=nullptr); | - | ||||||
232 | - | |||||||
233 | qreal xPosition() const; | - | ||||||
234 | qreal widthRatio() const; | - | ||||||
235 | qreal yPosition() const; | - | ||||||
236 | qreal heightRatio() const; | - | ||||||
237 | - | |||||||
238 | void updateVisible(); | - | ||||||
239 | - | |||||||
240 | public : | - | ||||||
241 | void xPositionChanged(qreal xPosition); | - | ||||||
242 | void yPositionChanged(qreal yPosition); | - | ||||||
243 | void widthRatioChanged(qreal widthRatio); | - | ||||||
244 | void heightRatioChanged(qreal heightRatio); | - | ||||||
245 | - | |||||||
246 | private: | - | ||||||
247 | QQuickFlickable *flickable; | - | ||||||
248 | qreal m_xPosition; | - | ||||||
249 | qreal m_widthRatio; | - | ||||||
250 | qreal m_yPosition; | - | ||||||
251 | qreal m_heightRatio; | - | ||||||
252 | }; | - | ||||||
253 | - | |||||||
254 | - | |||||||
255 | - | |||||||
256 | template <> struct QMetaTypeId< QQuickFlickableVisibleArea * > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const int id = metatype_id.loadAcquire()) return id; const int newId = qRegisterMetaType< QQuickFlickableVisibleArea * >("QQuickFlickableVisibleArea *", reinterpret_cast< QQuickFlickableVisibleArea * *>(quintptr(-1))); metatype_id.storeRelease(newId); return newId; } }; template <> struct QMetaTypeId< QQmlListProperty<QQuickFlickableVisibleArea> > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const int id = metatype_id.loadAcquire()) return id; const int newId = qRegisterMetaType< QQmlListProperty<QQuickFlickableVisibleArea> >("QQmlListProperty<QQuickFlickableVisibleArea>", reinterpret_cast< QQmlListProperty<QQuickFlickableVisibleArea> *>(quintptr(-1))); metatype_id.storeRelease(newId); return newId; } }; | - | ||||||
Switch to Source code | Preprocessed file |