| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickitemviewtransition_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 QQUICKITEMVIEWTRANSITION_P_P_H | - |
| 41 | #define QQUICKITEMVIEWTRANSITION_P_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 <QtQuick/private/qtquickglobal_p.h> | - |
| 55 | - | |
| 56 | QT_REQUIRE_CONFIG(quick_viewtransitions); | - |
| 57 | - | |
| 58 | #include <QtCore/qobject.h> | - |
| 59 | #include <QtCore/qpoint.h> | - |
| 60 | #include <QtQml/qqml.h> | - |
| 61 | #include <private/qqmlguard_p.h> | - |
| 62 | #include <private/qquicktransition_p.h> | - |
| 63 | - | |
| 64 | QT_BEGIN_NAMESPACE | - |
| 65 | - | |
| 66 | class QQuickItem; | - |
| 67 | class QQuickTransition; | - |
| 68 | class QQuickItemViewTransitionableItem; | - |
| 69 | class QQuickItemViewTransitionJob; | - |
| 70 | - | |
| 71 | - | |
| 72 | class Q_QUICK_PRIVATE_EXPORT QQuickItemViewTransitionChangeListener | - |
| 73 | { | - |
| 74 | public: | - |
| 75 | QQuickItemViewTransitionChangeListener() {} | - |
| 76 | virtual ~QQuickItemViewTransitionChangeListener() {} | - |
| 77 | - | |
| 78 | virtual void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) = 0; | - |
| 79 | }; | - |
| 80 | - | |
| 81 | - | |
| 82 | class Q_QUICK_PRIVATE_EXPORT QQuickItemViewTransitioner | - |
| 83 | { | - |
| 84 | public: | - |
| 85 | enum TransitionType { | - |
| 86 | NoTransition, | - |
| 87 | PopulateTransition, | - |
| 88 | AddTransition, | - |
| 89 | MoveTransition, | - |
| 90 | RemoveTransition | - |
| 91 | }; | - |
| 92 | - | |
| 93 | QQuickItemViewTransitioner(); | - |
| 94 | virtual ~QQuickItemViewTransitioner(); | - |
| 95 | - | |
| 96 | bool canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const; | - |
| 97 | void transitionNextReposition(QQuickItemViewTransitionableItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget); | - |
| 98 | - | |
| 99 | void addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickItemViewTransitionableItem *item, int index); | - |
| 100 | void resetTargetLists(); | - |
| 101 | - | |
| 102 | QQuickTransition *transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const; | - |
| 103 | const QList<int> &targetIndexes(QQuickItemViewTransitioner::TransitionType type) const; | - |
| 104 | const QList<QObject *> &targetItems(QQuickItemViewTransitioner::TransitionType type) const; | - |
| 105 | - | |
| 106 | inline void setPopulateTransitionEnabled(bool b) { usePopulateTransition = b; } executed 3340 times by 5 tests: end of blockExecuted by:
| 3340 |
| 107 | inline bool populateTransitionEnabled() const { return usePopulateTransition; } executed 3708 times by 2 tests: return usePopulateTransition;Executed by:
| 3708 |
| 108 | - | |
| 109 | inline void setChangeListener(QQuickItemViewTransitionChangeListener *obj) { changeListener = obj; } executed 832 times by 4 tests: end of blockExecuted by:
| 832 |
| 110 | - | |
| 111 | QSet<QQuickItemViewTransitionJob *> runningJobs; | - |
| 112 | - | |
| 113 | QList<int> addTransitionIndexes; | - |
| 114 | QList<int> moveTransitionIndexes; | - |
| 115 | QList<int> removeTransitionIndexes; | - |
| 116 | QList<QObject *> addTransitionTargets; | - |
| 117 | QList<QObject *> moveTransitionTargets; | - |
| 118 | QList<QObject *> removeTransitionTargets; | - |
| 119 | - | |
| 120 | QQmlGuard<QQuickTransition> populateTransition; | - |
| 121 | QQmlGuard<QQuickTransition> addTransition; | - |
| 122 | QQmlGuard<QQuickTransition> addDisplacedTransition; | - |
| 123 | QQmlGuard<QQuickTransition> moveTransition; | - |
| 124 | QQmlGuard<QQuickTransition> moveDisplacedTransition; | - |
| 125 | QQmlGuard<QQuickTransition> removeTransition; | - |
| 126 | QQmlGuard<QQuickTransition> removeDisplacedTransition; | - |
| 127 | QQmlGuard<QQuickTransition> displacedTransition; | - |
| 128 | - | |
| 129 | private: | - |
| 130 | friend class QQuickItemViewTransitionJob; | - |
| 131 | - | |
| 132 | QQuickItemViewTransitionChangeListener *changeListener; | - |
| 133 | bool usePopulateTransition; | - |
| 134 | - | |
| 135 | void finishedTransition(QQuickItemViewTransitionJob *job, QQuickItemViewTransitionableItem *item); | - |
| 136 | }; | - |
| 137 | - | |
| 138 | - | |
| 139 | /* | - |
| 140 | An item that can be transitioned using QQuickViewTransitionJob. | - |
| 141 | */ | - |
| 142 | class Q_QUICK_PRIVATE_EXPORT QQuickItemViewTransitionableItem | - |
| 143 | { | - |
| 144 | public: | - |
| 145 | QQuickItemViewTransitionableItem(QQuickItem *i); | - |
| 146 | virtual ~QQuickItemViewTransitionableItem(); | - |
| 147 | - | |
| 148 | qreal itemX() const; | - |
| 149 | qreal itemY() const; | - |
| 150 | - | |
| 151 | void moveTo(const QPointF &pos, bool immediate = false); | - |
| 152 | - | |
| 153 | bool transitionScheduledOrRunning() const; | - |
| 154 | bool transitionRunning() const; | - |
| 155 | bool isPendingRemoval() const; | - |
| 156 | - | |
| 157 | bool prepareTransition(QQuickItemViewTransitioner *transitioner, int index, const QRectF &viewBounds); | - |
| 158 | void startTransition(QQuickItemViewTransitioner *transitioner, int index); | - |
| 159 | - | |
| 160 | QPointF nextTransitionTo; | - |
| 161 | QPointF lastMovedTo; | - |
| 162 | QPointF nextTransitionFrom; | - |
| 163 | QQuickItem *item; | - |
| 164 | QQuickItemViewTransitionJob *transition; | - |
| 165 | QQuickItemViewTransitioner::TransitionType nextTransitionType; | - |
| 166 | bool isTransitionTarget : 1; | - |
| 167 | bool nextTransitionToSet : 1; | - |
| 168 | bool nextTransitionFromSet : 1; | - |
| 169 | bool lastMovedToSet : 1; | - |
| 170 | bool prepared : 1; | - |
| 171 | - | |
| 172 | private: | - |
| 173 | friend class QQuickItemViewTransitioner; | - |
| 174 | friend class QQuickItemViewTransitionJob; | - |
| 175 | void setNextTransition(QQuickItemViewTransitioner::TransitionType, bool isTargetItem); | - |
| 176 | bool transitionWillChangePosition() const; | - |
| 177 | void finishedTransition(); | - |
| 178 | void resetNextTransitionPos(); | - |
| 179 | void clearCurrentScheduledTransition(); | - |
| 180 | void stopTransition(); | - |
| 181 | }; | - |
| 182 | - | |
| 183 | - | |
| 184 | class QQuickViewTransitionAttached : public QObject | - |
| 185 | { | - |
| 186 | Q_OBJECT | - |
| 187 | - | |
| 188 | Q_PROPERTY(int index READ index NOTIFY indexChanged) | - |
| 189 | Q_PROPERTY(QQuickItem* item READ item NOTIFY itemChanged) | - |
| 190 | Q_PROPERTY(QPointF destination READ destination NOTIFY destinationChanged) | - |
| 191 | - | |
| 192 | Q_PROPERTY(QList<int> targetIndexes READ targetIndexes NOTIFY targetIndexesChanged) | - |
| 193 | Q_PROPERTY(QQmlListProperty<QObject> targetItems READ targetItems NOTIFY targetItemsChanged) | - |
| 194 | - | |
| 195 | public: | - |
| 196 | QQuickViewTransitionAttached(QObject *parent); | - |
| 197 | - | |
| 198 | int index() const { return m_index; } executed 8560 times by 3 tests: return m_index;Executed by:
| 8560 |
| 199 | QQuickItem *item() const { return m_item; } executed 8566 times by 3 tests: return m_item;Executed by:
| 8566 |
| 200 | QPointF destination() const { return m_destination; } never executed: return m_destination; | 0 |
| 201 | - | |
| 202 | QList<int> targetIndexes() const { return m_targetIndexes; } executed 9018 times by 3 tests: return m_targetIndexes;Executed by:
| 9018 |
| 203 | QQmlListProperty<QObject> targetItems(); | - |
| 204 | - | |
| 205 | static QQuickViewTransitionAttached *qmlAttachedProperties(QObject *); | - |
| 206 | - | |
| 207 | Q_SIGNALS: | - |
| 208 | void indexChanged(); | - |
| 209 | void itemChanged(); | - |
| 210 | void destinationChanged(); | - |
| 211 | - | |
| 212 | void targetIndexesChanged(); | - |
| 213 | void targetItemsChanged(); | - |
| 214 | - | |
| 215 | private: | - |
| 216 | friend class QQuickItemViewTransitionJob; | - |
| 217 | QPointF m_destination; | - |
| 218 | QList<int> m_targetIndexes; | - |
| 219 | QList<QObject *> m_targetItems; | - |
| 220 | - | |
| 221 | QQuickItem *m_item; | - |
| 222 | int m_index; | - |
| 223 | }; | - |
| 224 | - | |
| 225 | QT_END_NAMESPACE | - |
| 226 | - | |
| 227 | QML_DECLARE_TYPE(QQuickViewTransitionAttached) | - |
| 228 | QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES) | - |
| 229 | - | |
| 230 | #endif // QQUICKITEMVIEWTRANSITION_P_P_H | - |
| Source code | Switch to Preprocessed file |