| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickflickable_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
| 4 | ** Contact: https://www.qt.io/licensing/ | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 3 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
| 24 | ** | - |
| 25 | ** GNU General Public License Usage | - |
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
| 31 | ** included in the packaging of this file. Please review the following | - |
| 32 | ** information to ensure the GNU General Public License requirements will | - |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
| 35 | ** | - |
| 36 | ** $QT_END_LICENSE$ | - |
| 37 | ** | - |
| 38 | ****************************************************************************/ | - |
| 39 | - | |
| 40 | #ifndef QQUICKFLICKABLE_P_H | - |
| 41 | #define QQUICKFLICKABLE_P_H | - |
| 42 | - | |
| 43 | // | - |
| 44 | // W A R N I N G | - |
| 45 | // ------------- | - |
| 46 | // | - |
| 47 | // This file is not part of the Qt API. It exists purely as an | - |
| 48 | // implementation detail. This header file may change from version to | - |
| 49 | // version without notice, or even be removed. | - |
| 50 | // | - |
| 51 | // We mean it. | - |
| 52 | // | - |
| 53 | - | |
| 54 | #include "qquickitem.h" | - |
| 55 | #include <private/qtquickglobal_p.h> | - |
| 56 | - | |
| 57 | QT_BEGIN_NAMESPACE | - |
| 58 | - | |
| 59 | class QQuickFlickablePrivate; | - |
| 60 | class QQuickFlickableVisibleArea; | - |
| 61 | class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem | - |
| 62 | { | - |
| 63 | Q_OBJECT | - |
| 64 | - | |
| 65 | Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged) | - |
| 66 | Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) | - |
| 67 | Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged) | - |
| 68 | Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged) | - |
| 69 | Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT) | - |
| 70 | - | |
| 71 | Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged) | - |
| 72 | Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) | - |
| 73 | Q_PROPERTY(qreal originY READ originY NOTIFY originYChanged) | - |
| 74 | - | |
| 75 | Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged) | - |
| 76 | Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged) | - |
| 77 | Q_PROPERTY(qreal originX READ originX NOTIFY originXChanged) | - |
| 78 | - | |
| 79 | Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) | - |
| 80 | Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) | - |
| 81 | - | |
| 82 | Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged) | - |
| 83 | Q_PROPERTY(BoundsMovement boundsMovement READ boundsMovement WRITE setBoundsMovement NOTIFY boundsMovementChanged REVISION 10) | - |
| 84 | Q_PROPERTY(QQuickTransition *rebound READ rebound WRITE setRebound NOTIFY reboundChanged) | - |
| 85 | Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) | - |
| 86 | Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) | - |
| 87 | Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) | - |
| 88 | Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged) | - |
| 89 | Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged) | - |
| 90 | Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) | - |
| 91 | Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged) | - |
| 92 | Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged) | - |
| 93 | Q_PROPERTY(bool dragging READ isDragging NOTIFY draggingChanged) | - |
| 94 | Q_PROPERTY(bool draggingHorizontally READ isDraggingHorizontally NOTIFY draggingHorizontallyChanged) | - |
| 95 | Q_PROPERTY(bool draggingVertically READ isDraggingVertically NOTIFY draggingVerticallyChanged) | - |
| 96 | Q_PROPERTY(FlickableDirection flickableDirection READ flickableDirection WRITE setFlickableDirection NOTIFY flickableDirectionChanged) | - |
| 97 | - | |
| 98 | Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged) | - |
| 99 | Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged) | - |
| 100 | - | |
| 101 | Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) | - |
| 102 | Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged) | - |
| 103 | Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY isAtBoundaryChanged) | - |
| 104 | Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY isAtBoundaryChanged) | - |
| 105 | - | |
| 106 | Q_PROPERTY(QQuickFlickableVisibleArea *visibleArea READ visibleArea CONSTANT) | - |
| 107 | - | |
| 108 | Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY pixelAlignedChanged) | - |
| 109 | - | |
| 110 | Q_PROPERTY(qreal horizontalOvershoot READ horizontalOvershoot NOTIFY horizontalOvershootChanged REVISION 9) | - |
| 111 | Q_PROPERTY(qreal verticalOvershoot READ verticalOvershoot NOTIFY verticalOvershootChanged REVISION 9) | - |
| 112 | - | |
| 113 | Q_PROPERTY(QQmlListProperty<QObject> flickableData READ flickableData) | - |
| 114 | Q_PROPERTY(QQmlListProperty<QQuickItem> flickableChildren READ flickableChildren) | - |
| 115 | Q_CLASSINFO("DefaultProperty", "flickableData") | - |
| 116 | - | |
| 117 | public: | - |
| 118 | QQuickFlickable(QQuickItem *parent=nullptr); | - |
| 119 | ~QQuickFlickable(); | - |
| 120 | - | |
| 121 | QQmlListProperty<QObject> flickableData(); | - |
| 122 | QQmlListProperty<QQuickItem> flickableChildren(); | - |
| 123 | - | |
| 124 | enum BoundsBehaviorFlag { | - |
| 125 | StopAtBounds = 0x0, | - |
| 126 | DragOverBounds = 0x1, | - |
| 127 | OvershootBounds = 0x2, | - |
| 128 | DragAndOvershootBounds = DragOverBounds | OvershootBounds | - |
| 129 | }; | - |
| 130 | Q_DECLARE_FLAGS(BoundsBehavior, BoundsBehaviorFlag) | - |
| 131 | Q_FLAG(BoundsBehavior) | - |
| 132 | - | |
| 133 | BoundsBehavior boundsBehavior() const; | - |
| 134 | void setBoundsBehavior(BoundsBehavior); | - |
| 135 | - | |
| 136 | enum BoundsMovement { | - |
| 137 | // StopAtBounds = 0x0, | - |
| 138 | FollowBoundsBehavior = 0x1 | - |
| 139 | }; | - |
| 140 | Q_ENUM(BoundsMovement) | - |
| 141 | - | |
| 142 | BoundsMovement boundsMovement() const; | - |
| 143 | void setBoundsMovement(BoundsMovement movement); | - |
| 144 | - | |
| 145 | QQuickTransition *rebound() const; | - |
| 146 | void setRebound(QQuickTransition *transition); | - |
| 147 | - | |
| 148 | qreal contentWidth() const; | - |
| 149 | void setContentWidth(qreal); | - |
| 150 | - | |
| 151 | qreal contentHeight() const; | - |
| 152 | void setContentHeight(qreal); | - |
| 153 | - | |
| 154 | qreal contentX() const; | - |
| 155 | virtual void setContentX(qreal pos); | - |
| 156 | - | |
| 157 | qreal contentY() const; | - |
| 158 | virtual void setContentY(qreal pos); | - |
| 159 | - | |
| 160 | qreal topMargin() const; | - |
| 161 | void setTopMargin(qreal m); | - |
| 162 | - | |
| 163 | qreal bottomMargin() const; | - |
| 164 | void setBottomMargin(qreal m); | - |
| 165 | - | |
| 166 | qreal leftMargin() const; | - |
| 167 | void setLeftMargin(qreal m); | - |
| 168 | - | |
| 169 | qreal rightMargin() const; | - |
| 170 | void setRightMargin(qreal m); | - |
| 171 | - | |
| 172 | virtual qreal originY() const; | - |
| 173 | virtual qreal originX() const; | - |
| 174 | - | |
| 175 | bool isMoving() const; | - |
| 176 | bool isMovingHorizontally() const; | - |
| 177 | bool isMovingVertically() const; | - |
| 178 | bool isFlicking() const; | - |
| 179 | bool isFlickingHorizontally() const; | - |
| 180 | bool isFlickingVertically() const; | - |
| 181 | bool isDragging() const; | - |
| 182 | bool isDraggingHorizontally() const; | - |
| 183 | bool isDraggingVertically() const; | - |
| 184 | - | |
| 185 | int pressDelay() const; | - |
| 186 | void setPressDelay(int delay); | - |
| 187 | - | |
| 188 | qreal maximumFlickVelocity() const; | - |
| 189 | void setMaximumFlickVelocity(qreal); | - |
| 190 | - | |
| 191 | qreal flickDeceleration() const; | - |
| 192 | void setFlickDeceleration(qreal); | - |
| 193 | - | |
| 194 | bool isInteractive() const; | - |
| 195 | void setInteractive(bool); | - |
| 196 | - | |
| 197 | qreal horizontalVelocity() const; | - |
| 198 | qreal verticalVelocity() const; | - |
| 199 | - | |
| 200 | bool isAtXEnd() const; | - |
| 201 | bool isAtXBeginning() const; | - |
| 202 | bool isAtYEnd() const; | - |
| 203 | bool isAtYBeginning() const; | - |
| 204 | - | |
| 205 | QQuickItem *contentItem() const; | - |
| 206 | - | |
| 207 | enum FlickableDirection { AutoFlickDirection=0x0, HorizontalFlick=0x1, VerticalFlick=0x2, HorizontalAndVerticalFlick=0x3, | - |
| 208 | AutoFlickIfNeeded=0xc }; | - |
| 209 | Q_ENUM(FlickableDirection) | - |
| 210 | FlickableDirection flickableDirection() const; | - |
| 211 | void setFlickableDirection(FlickableDirection); | - |
| 212 | - | |
| 213 | bool pixelAligned() const; | - |
| 214 | void setPixelAligned(bool align); | - |
| 215 | - | |
| 216 | qreal horizontalOvershoot() const; | - |
| 217 | qreal verticalOvershoot() const; | - |
| 218 | - | |
| 219 | Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center); | - |
| 220 | Q_INVOKABLE void returnToBounds(); | - |
| 221 | Q_INVOKABLE void flick(qreal xVelocity, qreal yVelocity); | - |
| 222 | Q_INVOKABLE void cancelFlick(); | - |
| 223 | - | |
| 224 | Q_SIGNALS: | - |
| 225 | void contentWidthChanged(); | - |
| 226 | void contentHeightChanged(); | - |
| 227 | void contentXChanged(); | - |
| 228 | void contentYChanged(); | - |
| 229 | void topMarginChanged(); | - |
| 230 | void bottomMarginChanged(); | - |
| 231 | void leftMarginChanged(); | - |
| 232 | void rightMarginChanged(); | - |
| 233 | void originYChanged(); | - |
| 234 | void originXChanged(); | - |
| 235 | void movingChanged(); | - |
| 236 | void movingHorizontallyChanged(); | - |
| 237 | void movingVerticallyChanged(); | - |
| 238 | void flickingChanged(); | - |
| 239 | void flickingHorizontallyChanged(); | - |
| 240 | void flickingVerticallyChanged(); | - |
| 241 | void draggingChanged(); | - |
| 242 | void draggingHorizontallyChanged(); | - |
| 243 | void draggingVerticallyChanged(); | - |
| 244 | void horizontalVelocityChanged(); | - |
| 245 | void verticalVelocityChanged(); | - |
| 246 | void isAtBoundaryChanged(); | - |
| 247 | void flickableDirectionChanged(); | - |
| 248 | void interactiveChanged(); | - |
| 249 | void boundsBehaviorChanged(); | - |
| 250 | Q_REVISION(10) void boundsMovementChanged(); | - |
| 251 | void reboundChanged(); | - |
| 252 | void maximumFlickVelocityChanged(); | - |
| 253 | void flickDecelerationChanged(); | - |
| 254 | void pressDelayChanged(); | - |
| 255 | void movementStarted(); | - |
| 256 | void movementEnded(); | - |
| 257 | void flickStarted(); | - |
| 258 | void flickEnded(); | - |
| 259 | void dragStarted(); | - |
| 260 | void dragEnded(); | - |
| 261 | void pixelAlignedChanged(); | - |
| 262 | Q_REVISION(9) void horizontalOvershootChanged(); | - |
| 263 | Q_REVISION(9) void verticalOvershootChanged(); | - |
| 264 | - | |
| 265 | protected: | - |
| 266 | bool childMouseEventFilter(QQuickItem *, QEvent *) override; | - |
| 267 | void mousePressEvent(QMouseEvent *event) override; | - |
| 268 | void mouseMoveEvent(QMouseEvent *event) override; | - |
| 269 | void mouseReleaseEvent(QMouseEvent *event) override; | - |
| 270 | #if QT_CONFIG(wheelevent) | - |
| 271 | void wheelEvent(QWheelEvent *event) override; | - |
| 272 | #endif | - |
| 273 | void timerEvent(QTimerEvent *event) override; | - |
| 274 | - | |
| 275 | QQuickFlickableVisibleArea *visibleArea(); | - |
| 276 | - | |
| 277 | protected Q_SLOTS: | - |
| 278 | void movementStarting(); | - |
| 279 | void movementEnding(); | - |
| 280 | void movementEnding(bool hMovementEnding, bool vMovementEnding); | - |
| 281 | void velocityTimelineCompleted(); | - |
| 282 | void timelineCompleted(); | - |
| 283 | - | |
| 284 | protected: | - |
| 285 | virtual qreal minXExtent() const; | - |
| 286 | virtual qreal minYExtent() const; | - |
| 287 | virtual qreal maxXExtent() const; | - |
| 288 | virtual qreal maxYExtent() const; | - |
| 289 | qreal vWidth() const; | - |
| 290 | qreal vHeight() const; | - |
| 291 | void componentComplete() override; | - |
| 292 | virtual void viewportMoved(Qt::Orientations orient); | - |
| 293 | void geometryChanged(const QRectF &newGeometry, | - |
| 294 | const QRectF &oldGeometry) override; | - |
| 295 | void mouseUngrabEvent() override; | - |
| 296 | bool filterMouseEvent(QQuickItem *receiver, QMouseEvent *event); | - |
| 297 | - | |
| 298 | bool xflick() const; | - |
| 299 | bool yflick() const; | - |
| 300 | - | |
| 301 | protected: | - |
| 302 | QQuickFlickable(QQuickFlickablePrivate &dd, QQuickItem *parent); | - |
| 303 | - | |
| 304 | private: | - |
| 305 | Q_DISABLE_COPY(QQuickFlickable) | - |
| 306 | Q_DECLARE_PRIVATE(QQuickFlickable) executed 125369 times by 18 tests: return reinterpret_cast<QQuickFlickablePrivate *>(qGetPtrHelper(d_ptr));Executed by:
executed 752497 times by 18 tests: return reinterpret_cast<const QQuickFlickablePrivate *>(qGetPtrHelper(d_ptr));Executed by:
| 125369-752497 |
| 307 | friend class QQuickFlickableContentItem; | - |
| 308 | friend class QQuickFlickableVisibleArea; | - |
| 309 | friend class QQuickFlickableReboundTransition; | - |
| 310 | }; | - |
| 311 | - | |
| 312 | QT_END_NAMESPACE | - |
| 313 | - | |
| 314 | QML_DECLARE_TYPE(QQuickFlickable) | - |
| 315 | - | |
| 316 | #endif // QQUICKFLICKABLE_P_H | - |
| Source code | Switch to Preprocessed file |