| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickpathview_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 QQUICKPATHVIEW_P_H | - | ||||||
| 41 | #define QQUICKPATHVIEW_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 <private/qtquickglobal_p.h> | - | ||||||
| 55 | - | |||||||
| 56 | QT_REQUIRE_CONFIG(quick_pathview); | - | ||||||
| 57 | - | |||||||
| 58 | #include "qquickitem.h" | - | ||||||
| 59 | - | |||||||
| 60 | #include <private/qtquickglobal_p.h> | - | ||||||
| 61 | #include <private/qquickpath_p.h> | - | ||||||
| 62 | - | |||||||
| 63 | QT_BEGIN_NAMESPACE | - | ||||||
| 64 | - | |||||||
| 65 | class QQmlChangeSet; | - | ||||||
| 66 | - | |||||||
| 67 | class QQuickPathViewPrivate; | - | ||||||
| 68 | class QQuickPathViewAttached; | - | ||||||
| 69 | class Q_QUICK_PRIVATE_EXPORT QQuickPathView : public QQuickItem | - | ||||||
| 70 | { | - | ||||||
| 71 | Q_OBJECT | - | ||||||
| 72 | - | |||||||
| 73 | Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) | - | ||||||
| 74 | Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged) | - | ||||||
| 75 | Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) | - | ||||||
| 76 | Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged) | - | ||||||
| 77 | Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged) | - | ||||||
| 78 | - | |||||||
| 79 | Q_PROPERTY(QQmlComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) | - | ||||||
| 80 | Q_PROPERTY(QQuickItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) | - | ||||||
| 81 | - | |||||||
| 82 | Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) | - | ||||||
| 83 | Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) | - | ||||||
| 84 | Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) | - | ||||||
| 85 | Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) | - | ||||||
| 86 | - | |||||||
| 87 | Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged) | - | ||||||
| 88 | Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) | - | ||||||
| 89 | Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) | - | ||||||
| 90 | Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged) | - | ||||||
| 91 | - | |||||||
| 92 | Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) | - | ||||||
| 93 | Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) | - | ||||||
| 94 | Q_PROPERTY(bool dragging READ isDragging NOTIFY draggingChanged) | - | ||||||
| 95 | - | |||||||
| 96 | Q_PROPERTY(int count READ count NOTIFY countChanged) | - | ||||||
| 97 | Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) | - | ||||||
| 98 | Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount RESET resetPathItemCount NOTIFY pathItemCountChanged) | - | ||||||
| 99 | Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) | - | ||||||
| 100 | Q_PROPERTY(MovementDirection movementDirection READ movementDirection WRITE setMovementDirection NOTIFY movementDirectionChanged REVISION 7) | - | ||||||
| 101 | - | |||||||
| 102 | Q_PROPERTY(int cacheItemCount READ cacheItemCount WRITE setCacheItemCount NOTIFY cacheItemCountChanged) | - | ||||||
| 103 | - | |||||||
| 104 | public: | - | ||||||
| 105 | QQuickPathView(QQuickItem *parent = nullptr); | - | ||||||
| 106 | virtual ~QQuickPathView(); | - | ||||||
| 107 | - | |||||||
| 108 | QVariant model() const; | - | ||||||
| 109 | void setModel(const QVariant &); | - | ||||||
| 110 | - | |||||||
| 111 | QQuickPath *path() const; | - | ||||||
| 112 | void setPath(QQuickPath *); | - | ||||||
| 113 | - | |||||||
| 114 | int currentIndex() const; | - | ||||||
| 115 | void setCurrentIndex(int idx); | - | ||||||
| 116 | - | |||||||
| 117 | QQuickItem *currentItem() const; | - | ||||||
| 118 | - | |||||||
| 119 | qreal offset() const; | - | ||||||
| 120 | void setOffset(qreal offset); | - | ||||||
| 121 | - | |||||||
| 122 | QQmlComponent *highlight() const; | - | ||||||
| 123 | void setHighlight(QQmlComponent *highlight); | - | ||||||
| 124 | QQuickItem *highlightItem() const; | - | ||||||
| 125 | - | |||||||
| 126 | enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange }; | - | ||||||
| 127 | Q_ENUM(HighlightRangeMode) | - | ||||||
| 128 | HighlightRangeMode highlightRangeMode() const; | - | ||||||
| 129 | void setHighlightRangeMode(HighlightRangeMode mode); | - | ||||||
| 130 | - | |||||||
| 131 | qreal preferredHighlightBegin() const; | - | ||||||
| 132 | void setPreferredHighlightBegin(qreal); | - | ||||||
| 133 | - | |||||||
| 134 | qreal preferredHighlightEnd() const; | - | ||||||
| 135 | void setPreferredHighlightEnd(qreal); | - | ||||||
| 136 | - | |||||||
| 137 | int highlightMoveDuration() const; | - | ||||||
| 138 | void setHighlightMoveDuration(int); | - | ||||||
| 139 | - | |||||||
| 140 | qreal dragMargin() const; | - | ||||||
| 141 | void setDragMargin(qreal margin); | - | ||||||
| 142 | - | |||||||
| 143 | qreal flickDeceleration() const; | - | ||||||
| 144 | void setFlickDeceleration(qreal dec); | - | ||||||
| 145 | - | |||||||
| 146 | qreal maximumFlickVelocity() const; | - | ||||||
| 147 | void setMaximumFlickVelocity(qreal); | - | ||||||
| 148 | - | |||||||
| 149 | bool isInteractive() const; | - | ||||||
| 150 | void setInteractive(bool); | - | ||||||
| 151 | - | |||||||
| 152 | bool isMoving() const; | - | ||||||
| 153 | bool isFlicking() const; | - | ||||||
| 154 | bool isDragging() const; | - | ||||||
| 155 | - | |||||||
| 156 | int count() const; | - | ||||||
| 157 | - | |||||||
| 158 | QQmlComponent *delegate() const; | - | ||||||
| 159 | void setDelegate(QQmlComponent *); | - | ||||||
| 160 | - | |||||||
| 161 | int pathItemCount() const; | - | ||||||
| 162 | void setPathItemCount(int); | - | ||||||
| 163 | void resetPathItemCount(); | - | ||||||
| 164 | - | |||||||
| 165 | int cacheItemCount() const; | - | ||||||
| 166 | void setCacheItemCount(int); | - | ||||||
| 167 | - | |||||||
| 168 | enum SnapMode { NoSnap, SnapToItem, SnapOneItem }; | - | ||||||
| 169 | Q_ENUM(SnapMode) | - | ||||||
| 170 | SnapMode snapMode() const; | - | ||||||
| 171 | void setSnapMode(SnapMode mode); | - | ||||||
| 172 | - | |||||||
| 173 | enum MovementDirection { Shortest, Negative, Positive }; | - | ||||||
| 174 | Q_ENUM(MovementDirection) | - | ||||||
| 175 | MovementDirection movementDirection() const; | - | ||||||
| 176 | void setMovementDirection(MovementDirection dir); | - | ||||||
| 177 | - | |||||||
| 178 | enum PositionMode { Beginning, Center, End, Contain=4, SnapPosition }; // 3 == Visible in other views | - | ||||||
| 179 | Q_ENUM(PositionMode) | - | ||||||
| 180 | Q_INVOKABLE void positionViewAtIndex(int index, int mode); | - | ||||||
| 181 | Q_INVOKABLE int indexAt(qreal x, qreal y) const; | - | ||||||
| 182 | Q_INVOKABLE QQuickItem *itemAt(qreal x, qreal y) const; | - | ||||||
| 183 | - | |||||||
| 184 | static QQuickPathViewAttached *qmlAttachedProperties(QObject *); | - | ||||||
| 185 | - | |||||||
| 186 | public Q_SLOTS: | - | ||||||
| 187 | void incrementCurrentIndex(); | - | ||||||
| 188 | void decrementCurrentIndex(); | - | ||||||
| 189 | - | |||||||
| 190 | Q_SIGNALS: | - | ||||||
| 191 | void currentIndexChanged(); | - | ||||||
| 192 | void currentItemChanged(); | - | ||||||
| 193 | void offsetChanged(); | - | ||||||
| 194 | void modelChanged(); | - | ||||||
| 195 | void countChanged(); | - | ||||||
| 196 | void pathChanged(); | - | ||||||
| 197 | void preferredHighlightBeginChanged(); | - | ||||||
| 198 | void preferredHighlightEndChanged(); | - | ||||||
| 199 | void highlightRangeModeChanged(); | - | ||||||
| 200 | void dragMarginChanged(); | - | ||||||
| 201 | void snapPositionChanged(); | - | ||||||
| 202 | void delegateChanged(); | - | ||||||
| 203 | void pathItemCountChanged(); | - | ||||||
| 204 | void maximumFlickVelocityChanged(); | - | ||||||
| 205 | void flickDecelerationChanged(); | - | ||||||
| 206 | void interactiveChanged(); | - | ||||||
| 207 | void movingChanged(); | - | ||||||
| 208 | void flickingChanged(); | - | ||||||
| 209 | void draggingChanged(); | - | ||||||
| 210 | void highlightChanged(); | - | ||||||
| 211 | void highlightItemChanged(); | - | ||||||
| 212 | void highlightMoveDurationChanged(); | - | ||||||
| 213 | void movementStarted(); | - | ||||||
| 214 | void movementEnded(); | - | ||||||
| 215 | Q_REVISION(7) void movementDirectionChanged(); | - | ||||||
| 216 | void flickStarted(); | - | ||||||
| 217 | void flickEnded(); | - | ||||||
| 218 | void dragStarted(); | - | ||||||
| 219 | void dragEnded(); | - | ||||||
| 220 | void snapModeChanged(); | - | ||||||
| 221 | void cacheItemCountChanged(); | - | ||||||
| 222 | - | |||||||
| 223 | protected: | - | ||||||
| 224 | void updatePolish() override; | - | ||||||
| 225 | void mousePressEvent(QMouseEvent *event) override; | - | ||||||
| 226 | void mouseMoveEvent(QMouseEvent *event) override; | - | ||||||
| 227 | void mouseReleaseEvent(QMouseEvent *) override; | - | ||||||
| 228 | bool sendMouseEvent(QMouseEvent *event); | - | ||||||
| 229 | bool childMouseEventFilter(QQuickItem *, QEvent *) override; | - | ||||||
| 230 | void mouseUngrabEvent() override; | - | ||||||
| 231 | void componentComplete() override; | - | ||||||
| 232 | - | |||||||
| 233 | private Q_SLOTS: | - | ||||||
| 234 | void refill(); | - | ||||||
| 235 | void ticked(); | - | ||||||
| 236 | void movementEnding(); | - | ||||||
| 237 | void modelUpdated(const QQmlChangeSet &changeSet, bool reset); | - | ||||||
| 238 | void createdItem(int index, QObject *item); | - | ||||||
| 239 | void initItem(int index, QObject *item); | - | ||||||
| 240 | void destroyingItem(QObject *item); | - | ||||||
| 241 | void pathUpdated(); | - | ||||||
| 242 | - | |||||||
| 243 | private: | - | ||||||
| 244 | friend class QQuickPathViewAttached; | - | ||||||
| 245 | Q_DISABLE_COPY(QQuickPathView) | - | ||||||
| 246 | Q_DECLARE_PRIVATE(QQuickPathView) executed 19000 times by 3 tests: return reinterpret_cast<QQuickPathViewPrivate *>(qGetPtrHelper(d_ptr));Executed by:
executed 4003 times by 3 tests: return reinterpret_cast<const QQuickPathViewPrivate *>(qGetPtrHelper(d_ptr));Executed by:
| 4003-19000 | ||||||
| 247 | }; | - | ||||||
| 248 | - | |||||||
| 249 | class QQmlOpenMetaObject; | - | ||||||
| 250 | class QQuickPathViewAttached : public QObject | - | ||||||
| 251 | { | - | ||||||
| 252 | Q_OBJECT | - | ||||||
| 253 | - | |||||||
| 254 | Q_PROPERTY(QQuickPathView *view READ view CONSTANT) | - | ||||||
| 255 | Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) | - | ||||||
| 256 | Q_PROPERTY(bool onPath READ isOnPath NOTIFY pathChanged) | - | ||||||
| 257 | - | |||||||
| 258 | public: | - | ||||||
| 259 | QQuickPathViewAttached(QObject *parent); | - | ||||||
| 260 | ~QQuickPathViewAttached(); | - | ||||||
| 261 | - | |||||||
| 262 | QQuickPathView *view() const { return m_view; } executed 312 times by 1 test: return m_view;Executed by:
| 312 | ||||||
| 263 | - | |||||||
| 264 | bool isCurrentItem() const { return m_isCurrent; } executed 3396 times by 2 tests: return m_isCurrent;Executed by:
| 3396 | ||||||
| 265 | void setIsCurrentItem(bool c) { | - | ||||||
| 266 | if (m_isCurrent != c) {
| 20-1514 | ||||||
| 267 | m_isCurrent = c; | - | ||||||
| 268 | Q_EMIT currentItemChanged(); | - | ||||||
| 269 | } executed 1514 times by 3 tests: end of blockExecuted by:
| 1514 | ||||||
| 270 | } executed 1534 times by 3 tests: end of blockExecuted by:
| 1534 | ||||||
| 271 | - | |||||||
| 272 | QVariant value(const QByteArray &name) const; | - | ||||||
| 273 | void setValue(const QByteArray &name, const QVariant &val); | - | ||||||
| 274 | - | |||||||
| 275 | bool isOnPath() const { return m_onPath; } executed 1554 times by 2 tests: return m_onPath;Executed by:
| 1554 | ||||||
| 276 | void setOnPath(bool on) { | - | ||||||
| 277 | if (on != m_onPath) {
| 5531-41157 | ||||||
| 278 | m_onPath = on; | - | ||||||
| 279 | Q_EMIT pathChanged(); | - | ||||||
| 280 | } executed 5531 times by 3 tests: end of blockExecuted by:
| 5531 | ||||||
| 281 | } executed 46688 times by 3 tests: end of blockExecuted by:
| 46688 | ||||||
| 282 | qreal m_percent; | - | ||||||
| 283 | - | |||||||
| 284 | Q_SIGNALS: | - | ||||||
| 285 | void currentItemChanged(); | - | ||||||
| 286 | void pathChanged(); | - | ||||||
| 287 | - | |||||||
| 288 | private: | - | ||||||
| 289 | friend class QQuickPathViewPrivate; | - | ||||||
| 290 | friend class QQuickPathView; | - | ||||||
| 291 | QQuickPathView *m_view; | - | ||||||
| 292 | QQmlOpenMetaObject *m_metaobject; | - | ||||||
| 293 | bool m_onPath : 1; | - | ||||||
| 294 | bool m_isCurrent : 1; | - | ||||||
| 295 | }; | - | ||||||
| 296 | - | |||||||
| 297 | - | |||||||
| 298 | QT_END_NAMESPACE | - | ||||||
| 299 | - | |||||||
| 300 | QML_DECLARE_TYPE(QQuickPathView) | - | ||||||
| 301 | QML_DECLARE_TYPEINFO(QQuickPathView, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||
| 302 | - | |||||||
| 303 | #endif // QQUICKPATHVIEW_P_H | - | ||||||
| Source code | Switch to Preprocessed file |