| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickitemviewfxitem.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2018 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 | #include "qquickitemviewfxitem_p_p.h" | - | ||||||||||||||||||
| 41 | #include "qquickitem_p.h" | - | ||||||||||||||||||
| 42 | #include "qquickitemview_p_p.h" | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | QQuickItemViewFxItem::QQuickItemViewFxItem(QQuickItem *item, bool ownItem, QQuickItemChangeListener* changeListener) | - | ||||||||||||||||||
| 47 | : item(item) | - | ||||||||||||||||||
| 48 | , ownItem(ownItem) | - | ||||||||||||||||||
| 49 | , changeListener(changeListener) | - | ||||||||||||||||||
| 50 | , transitionableItem(nullptr) | - | ||||||||||||||||||
| 51 | , releaseAfterTransition(false) | - | ||||||||||||||||||
| 52 | , trackGeom(false) | - | ||||||||||||||||||
| 53 | { | - | ||||||||||||||||||
| 54 | } executed 87958 times by 11 tests: end of blockExecuted by:
| 87958 | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | QQuickItemViewFxItem::~QQuickItemViewFxItem() | - | ||||||||||||||||||
| 57 | { | - | ||||||||||||||||||
| 58 | delete transitionableItem; | - | ||||||||||||||||||
| 59 | if (ownItem && item) {
| 4718-80654 | ||||||||||||||||||
| 60 | trackGeometry(false); | - | ||||||||||||||||||
| 61 | item->setParentItem(0); | - | ||||||||||||||||||
| 62 | item->deleteLater(); | - | ||||||||||||||||||
| 63 | } executed 4718 times by 10 tests: end of blockExecuted by:
| 4718 | ||||||||||||||||||
| 64 | } executed 85372 times by 10 tests: end of blockExecuted by:
| 85372 | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | qreal QQuickItemViewFxItem::itemX() const | - | ||||||||||||||||||
| 67 | { | - | ||||||||||||||||||
| 68 | return transitionableItem ? transitionableItem->itemX() : (item ? item->x() : 0); executed 647451 times by 11 tests: return transitionableItem ? transitionableItem->itemX() : (item ? item->x() : 0);Executed by:
| 647451 | ||||||||||||||||||
| 69 | } | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | qreal QQuickItemViewFxItem::itemY() const | - | ||||||||||||||||||
| 72 | { | - | ||||||||||||||||||
| 73 | return transitionableItem ? transitionableItem->itemY() : (item ? item->y() : 0); executed 961025 times by 11 tests: return transitionableItem ? transitionableItem->itemY() : (item ? item->y() : 0);Executed by:
| 961025 | ||||||||||||||||||
| 74 | } | - | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | void QQuickItemViewFxItem::moveTo(const QPointF &pos, bool immediate) | - | ||||||||||||||||||
| 77 | { | - | ||||||||||||||||||
| 78 | if (transitionableItem)
| 8094-197825 | ||||||||||||||||||
| 79 | transitionableItem->moveTo(pos, immediate); executed 8094 times by 4 tests: transitionableItem->moveTo(pos, immediate);Executed by:
| 8094 | ||||||||||||||||||
| 80 | else if (item)
| 0-197825 | ||||||||||||||||||
| 81 | item->setPosition(pos); executed 197825 times by 11 tests: item->setPosition(pos);Executed by:
| 197825 | ||||||||||||||||||
| 82 | } executed 205919 times by 11 tests: end of blockExecuted by:
| 205919 | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | void QQuickItemViewFxItem::setVisible(bool visible) | - | ||||||||||||||||||
| 85 | { | - | ||||||||||||||||||
| 86 | if (!visible && transitionableItem && transitionableItem->transitionScheduledOrRunning())
| 0-105470 | ||||||||||||||||||
| 87 | return; executed 612 times by 2 tests: return;Executed by:
| 612 | ||||||||||||||||||
| 88 | if (item)
| 0-112654 | ||||||||||||||||||
| 89 | QQuickItemPrivate::get(item)->setCulled(!visible); executed 112654 times by 8 tests: QQuickItemPrivate::get(item)->setCulled(!visible);Executed by:
| 112654 | ||||||||||||||||||
| 90 | } executed 112654 times by 8 tests: end of blockExecuted by:
| 112654 | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | void QQuickItemViewFxItem::trackGeometry(bool track) | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | if (track) {
| 85522-87958 | ||||||||||||||||||
| 95 | if (!trackGeom) {
| 0-87958 | ||||||||||||||||||
| 96 | if (item) {
| 0-87958 | ||||||||||||||||||
| 97 | QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); | - | ||||||||||||||||||
| 98 | itemPrivate->addItemChangeListener(changeListener, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||
| 99 | } executed 87958 times by 11 tests: end of blockExecuted by:
| 87958 | ||||||||||||||||||
| 100 | trackGeom = true; | - | ||||||||||||||||||
| 101 | } executed 87958 times by 11 tests: end of blockExecuted by:
| 87958 | ||||||||||||||||||
| 102 | } else { executed 87958 times by 11 tests: end of blockExecuted by:
| 87958 | ||||||||||||||||||
| 103 | if (trackGeom) {
| 150-85372 | ||||||||||||||||||
| 104 | if (item) {
| 0-85372 | ||||||||||||||||||
| 105 | QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); | - | ||||||||||||||||||
| 106 | itemPrivate->removeItemChangeListener(changeListener, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||
| 107 | } executed 85372 times by 10 tests: end of blockExecuted by:
| 85372 | ||||||||||||||||||
| 108 | trackGeom = false; | - | ||||||||||||||||||
| 109 | } executed 85372 times by 10 tests: end of blockExecuted by:
| 85372 | ||||||||||||||||||
| 110 | } executed 85522 times by 10 tests: end of blockExecuted by:
| 85522 | ||||||||||||||||||
| 111 | } | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | QRectF QQuickItemViewFxItem::geometry() const | - | ||||||||||||||||||
| 114 | { | - | ||||||||||||||||||
| 115 | return QRectF(item->position(), item->size()); never executed: return QRectF(item->position(), item->size()); | 0 | ||||||||||||||||||
| 116 | } | - | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | void QQuickItemViewFxItem::setGeometry(const QRectF &geometry) | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | item->setPosition(geometry.topLeft()); | - | ||||||||||||||||||
| 121 | item->setSize(geometry.size()); | - | ||||||||||||||||||
| 122 | } never executed: end of block | 0 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | QQuickItemViewTransitioner::TransitionType QQuickItemViewFxItem::scheduledTransitionType() const | - | ||||||||||||||||||
| 125 | { | - | ||||||||||||||||||
| 126 | return transitionableItem ? transitionableItem->nextTransitionType : QQuickItemViewTransitioner::NoTransition; executed 330 times by 2 tests: return transitionableItem ? transitionableItem->nextTransitionType : QQuickItemViewTransitioner::NoTransition;Executed by:
| 330 | ||||||||||||||||||
| 127 | } | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | bool QQuickItemViewFxItem::transitionScheduledOrRunning() const | - | ||||||||||||||||||
| 130 | { | - | ||||||||||||||||||
| 131 | return transitionableItem ? transitionableItem->transitionScheduledOrRunning() : false; executed 12454 times by 6 tests: return transitionableItem ? transitionableItem->transitionScheduledOrRunning() : false;Executed by:
| 12454 | ||||||||||||||||||
| 132 | } | - | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | bool QQuickItemViewFxItem::transitionRunning() const | - | ||||||||||||||||||
| 135 | { | - | ||||||||||||||||||
| 136 | return transitionableItem ? transitionableItem->transitionRunning() : false; executed 2292 times by 3 tests: return transitionableItem ? transitionableItem->transitionRunning() : false;Executed by:
| 2292 | ||||||||||||||||||
| 137 | } | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | bool QQuickItemViewFxItem::isPendingRemoval() const | - | ||||||||||||||||||
| 140 | { | - | ||||||||||||||||||
| 141 | return transitionableItem ? transitionableItem->isPendingRemoval() : false; executed 62 times by 2 tests: return transitionableItem ? transitionableItem->isPendingRemoval() : false;Executed by:
| 62 | ||||||||||||||||||
| 142 | } | - | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | void QQuickItemViewFxItem::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | if (!transitioner)
| 7592-34769 | ||||||||||||||||||
| 147 | return; executed 34769 times by 3 tests: return;Executed by:
| 34769 | ||||||||||||||||||
| 148 | if (!transitionableItem)
| 1670-5922 | ||||||||||||||||||
| 149 | transitionableItem = new QQuickItemViewTransitionableItem(item); executed 5922 times by 4 tests: transitionableItem = new QQuickItemViewTransitionableItem(item);Executed by:
| 5922 | ||||||||||||||||||
| 150 | transitioner->transitionNextReposition(transitionableItem, type, asTarget); | - | ||||||||||||||||||
| 151 | } executed 7592 times by 4 tests: end of blockExecuted by:
| 7592 | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | bool QQuickItemViewFxItem::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds) | - | ||||||||||||||||||
| 154 | { | - | ||||||||||||||||||
| 155 | return transitionableItem ? transitionableItem->prepareTransition(transitioner, index, viewBounds) : false; executed 13330 times by 4 tests: return transitionableItem ? transitionableItem->prepareTransition(transitioner, index, viewBounds) : false;Executed by:
| 13330 | ||||||||||||||||||
| 156 | } | - | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | void QQuickItemViewFxItem::startTransition(QQuickItemViewTransitioner *transitioner) | - | ||||||||||||||||||
| 159 | { | - | ||||||||||||||||||
| 160 | if (transitionableItem)
| 6482-6690 | ||||||||||||||||||
| 161 | transitionableItem->startTransition(transitioner, index); executed 6482 times by 4 tests: transitionableItem->startTransition(transitioner, index);Executed by:
| 6482 | ||||||||||||||||||
| 162 | } executed 13172 times by 4 tests: end of blockExecuted by:
| 13172 | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| Source code | Switch to Preprocessed file |