| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickgridview.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||
| 14 | class FxGridItemSG : public FxViewItem | - | ||||||||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||||||||
| 16 | public: | - | ||||||||||||||||||||||||||||||
| 17 | FxGridItemSG(QQuickItem *i, QQuickGridView *v, bool own) : FxViewItem(i, v, own, static_cast<QQuickItemViewAttached*>(qmlAttachedPropertiesObject<QQuickGridView>(i))), view(v) | - | ||||||||||||||||||||||||||||||
| 18 | { | - | ||||||||||||||||||||||||||||||
| 19 | } executed 51741 times by 4 tests: end of blockExecuted by:
| 51741 | ||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||
| 21 | qreal position() const override { | - | ||||||||||||||||||||||||||||||
| 22 | return executed 61291 times by 4 tests: rowPos();return rowPos();Executed by:
executed 61291 times by 4 tests: return rowPos();Executed by:
| 61291 | ||||||||||||||||||||||||||||||
| 23 | } | - | ||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||
| 25 | qreal endPosition() const override { | - | ||||||||||||||||||||||||||||||
| 26 | return executed 16817 times by 3 tests: endRowPos();return endRowPos();Executed by:
executed 16817 times by 3 tests: return endRowPos();Executed by:
| 16817 | ||||||||||||||||||||||||||||||
| 27 | } | - | ||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||
| 29 | qreal size() const override { | - | ||||||||||||||||||||||||||||||
| 30 | return executed 13616 times by 3 tests: view->flow() == QQuickGridView::FlowLeftToRight ? view->cellHeight() : view->cellWidth();return view->flow() == QQuickGridView::FlowLeftToRight ? view->cellHeight() : view->cellWidth();Executed by:
executed 13616 times by 3 tests: return view->flow() == QQuickGridView::FlowLeftToRight ? view->cellHeight() : view->cellWidth();Executed by:
| 13616 | ||||||||||||||||||||||||||||||
| 31 | } | - | ||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||
| 33 | qreal sectionSize() const override { | - | ||||||||||||||||||||||||||||||
| 34 | return executed 12548 times by 3 tests: 0.0;return 0.0;Executed by:
executed 12548 times by 3 tests: return 0.0;Executed by:
| 12548 | ||||||||||||||||||||||||||||||
| 35 | } | - | ||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||
| 37 | qreal rowPos() const { | - | ||||||||||||||||||||||||||||||
| 38 | if (view->flow() == QQuickGridView::FlowLeftToRight
| 338667-375994 | ||||||||||||||||||||||||||||||
| 39 | return executed 375994 times by 4 tests: (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -view->cellHeight()-itemY() : itemY());return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -view->cellHeight()-itemY() : itemY());Executed by:
executed 375994 times by 4 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -view->cellHeight()-itemY() : itemY());Executed by:
| 375994 | ||||||||||||||||||||||||||||||
| 40 | else | - | ||||||||||||||||||||||||||||||
| 41 | return executed 338667 times by 1 test: (view->effectiveLayoutDirection() == Qt::RightToLeft ? -view->cellWidth()-itemX() : itemX());return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -view->cellWidth()-itemX() : itemX());Executed by:
executed 338667 times by 1 test: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -view->cellWidth()-itemX() : itemX());Executed by:
| 338667 | ||||||||||||||||||||||||||||||
| 42 | } | - | ||||||||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||||||||
| 44 | qreal colPos() const { | - | ||||||||||||||||||||||||||||||
| 45 | if (view->flow() == QQuickGridView::FlowLeftToRight
| 67873-85100 | ||||||||||||||||||||||||||||||
| 46 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 14264-70836 | ||||||||||||||||||||||||||||||
| 47 | qreal colSize = view->cellWidth(); | - | ||||||||||||||||||||||||||||||
| 48 | int columns = view->width()/colSize; | - | ||||||||||||||||||||||||||||||
| 49 | return executed 14264 times by 1 test: colSize * (columns-1) - itemX();return colSize * (columns-1) - itemX();Executed by:
executed 14264 times by 1 test: return colSize * (columns-1) - itemX();Executed by:
| 14264 | ||||||||||||||||||||||||||||||
| 50 | } else { | - | ||||||||||||||||||||||||||||||
| 51 | return executed 70836 times by 4 tests: itemX();return itemX();Executed by:
executed 70836 times by 4 tests: return itemX();Executed by:
| 70836 | ||||||||||||||||||||||||||||||
| 52 | } | - | ||||||||||||||||||||||||||||||
| 53 | } else { | - | ||||||||||||||||||||||||||||||
| 54 | if (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
| 13434-54439 | ||||||||||||||||||||||||||||||
| 55 | return executed 13434 times by 1 test: -view->cellHeight() - itemY();return -view->cellHeight() - itemY();Executed by:
executed 13434 times by 1 test: return -view->cellHeight() - itemY();Executed by:
| 13434 | ||||||||||||||||||||||||||||||
| 56 | } else { | - | ||||||||||||||||||||||||||||||
| 57 | return executed 54439 times by 1 test: itemY();return itemY();Executed by:
executed 54439 times by 1 test: return itemY();Executed by:
| 54439 | ||||||||||||||||||||||||||||||
| 58 | } | - | ||||||||||||||||||||||||||||||
| 59 | } | - | ||||||||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||||||||
| 61 | qreal endRowPos() const { | - | ||||||||||||||||||||||||||||||
| 62 | if (view->flow() == QQuickGridView::FlowLeftToRight
| 5260-11557 | ||||||||||||||||||||||||||||||
| 63 | if (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
| 2332-9225 | ||||||||||||||||||||||||||||||
| 64 | return executed 2332 times by 1 test: -itemY();return -itemY();Executed by:
executed 2332 times by 1 test: return -itemY();Executed by:
| 2332 | ||||||||||||||||||||||||||||||
| 65 | else | - | ||||||||||||||||||||||||||||||
| 66 | return executed 9225 times by 3 tests: itemY() + view->cellHeight();return itemY() + view->cellHeight();Executed by:
executed 9225 times by 3 tests: return itemY() + view->cellHeight();Executed by:
| 9225 | ||||||||||||||||||||||||||||||
| 67 | } else { | - | ||||||||||||||||||||||||||||||
| 68 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 2470-2790 | ||||||||||||||||||||||||||||||
| 69 | return executed 2790 times by 1 test: -itemX();return -itemX();Executed by:
executed 2790 times by 1 test: return -itemX();Executed by:
| 2790 | ||||||||||||||||||||||||||||||
| 70 | else | - | ||||||||||||||||||||||||||||||
| 71 | return executed 2470 times by 1 test: itemX() + view->cellWidth();return itemX() + view->cellWidth();Executed by:
executed 2470 times by 1 test: return itemX() + view->cellWidth();Executed by:
| 2470 | ||||||||||||||||||||||||||||||
| 72 | } | - | ||||||||||||||||||||||||||||||
| 73 | } | - | ||||||||||||||||||||||||||||||
| 74 | void setPosition(qreal col, qreal row, bool immediate = false) { | - | ||||||||||||||||||||||||||||||
| 75 | moveTo(pointForPosition(col, row), immediate); | - | ||||||||||||||||||||||||||||||
| 76 | } executed 122852 times by 4 tests: end of blockExecuted by:
| 122852 | ||||||||||||||||||||||||||||||
| 77 | bool contains(qreal x, qreal y) const override { | - | ||||||||||||||||||||||||||||||
| 78 | return executed 62 times by 1 test: (x >= itemX() && x < itemX() + view->cellWidth() &&return (x >= itemX() && x < itemX() + view->cellWidth() && y >= itemY() && y < itemY() + view->cellHeight());Executed by:
executed 62 times by 1 test: return (x >= itemX() && x < itemX() + view->cellWidth() && y >= itemY() && y < itemY() + view->cellHeight());Executed by:
| 62 | ||||||||||||||||||||||||||||||
| 79 | y >= itemY() && y < itemY() + view->cellHeight()); executed 62 times by 1 test: return (x >= itemX() && x < itemX() + view->cellWidth() && y >= itemY() && y < itemY() + view->cellHeight());Executed by:
| 62 | ||||||||||||||||||||||||||||||
| 80 | } | - | ||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||
| 82 | QQuickGridView *view; | - | ||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||
| 84 | private: | - | ||||||||||||||||||||||||||||||
| 85 | QPointF pointForPosition(qreal col, qreal row) const { | - | ||||||||||||||||||||||||||||||
| 86 | qreal x; | - | ||||||||||||||||||||||||||||||
| 87 | qreal y; | - | ||||||||||||||||||||||||||||||
| 88 | if (view->flow() == QQuickGridView::FlowLeftToRight
| 48557-74295 | ||||||||||||||||||||||||||||||
| 89 | x = col; | - | ||||||||||||||||||||||||||||||
| 90 | y = row; | - | ||||||||||||||||||||||||||||||
| 91 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 19984-54311 | ||||||||||||||||||||||||||||||
| 92 | int columns = view->width()/view->cellWidth(); | - | ||||||||||||||||||||||||||||||
| 93 | x = view->cellWidth() * (columns-1) - col; | - | ||||||||||||||||||||||||||||||
| 94 | } executed 19984 times by 1 test: end of blockExecuted by:
| 19984 | ||||||||||||||||||||||||||||||
| 95 | } executed 74295 times by 4 tests: else {end of blockExecuted by:
| 74295 | ||||||||||||||||||||||||||||||
| 96 | x = row; | - | ||||||||||||||||||||||||||||||
| 97 | y = col; | - | ||||||||||||||||||||||||||||||
| 98 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 24019-24538 | ||||||||||||||||||||||||||||||
| 99 | x = -view->cellWidth() - row; executed 24538 times by 1 test: x = -view->cellWidth() - row;Executed by:
| 24538 | ||||||||||||||||||||||||||||||
| 100 | } executed 48557 times by 1 test: end of blockExecuted by:
| 48557 | ||||||||||||||||||||||||||||||
| 101 | if (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
| 40896-81956 | ||||||||||||||||||||||||||||||
| 102 | y = -view->cellHeight() - y; executed 40896 times by 1 test: y = -view->cellHeight() - y;Executed by:
| 40896 | ||||||||||||||||||||||||||||||
| 103 | return executed 122852 times by 4 tests: QPointF(x, y);return QPointF(x, y);Executed by:
executed 122852 times by 4 tests: return QPointF(x, y);Executed by:
| 122852 | ||||||||||||||||||||||||||||||
| 104 | } | - | ||||||||||||||||||||||||||||||
| 105 | }; | - | ||||||||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||
| 109 | class QQuickGridViewPrivate : public QQuickItemViewPrivate | - | ||||||||||||||||||||||||||||||
| 110 | { | - | ||||||||||||||||||||||||||||||
| 111 | inline QQuickGridView* q_func() { return static_cast<QQuickGridView *>(q_ptr); } inline const QQuickGridView* q_func() const { return static_cast<const QQuickGridView *>(q_ptr); } friend class QQuickGridView; | - | ||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||
| 113 | public: | - | ||||||||||||||||||||||||||||||
| 114 | Qt::Orientation layoutOrientation() const override; | - | ||||||||||||||||||||||||||||||
| 115 | bool isContentFlowReversed() const override; | - | ||||||||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||||||||
| 117 | qreal positionAt(int index) const override; | - | ||||||||||||||||||||||||||||||
| 118 | qreal endPositionAt(int index) const override; | - | ||||||||||||||||||||||||||||||
| 119 | qreal originPosition() const override; | - | ||||||||||||||||||||||||||||||
| 120 | qreal lastPosition() const override; | - | ||||||||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||||||||
| 122 | qreal rowSize() const; | - | ||||||||||||||||||||||||||||||
| 123 | qreal colSize() const; | - | ||||||||||||||||||||||||||||||
| 124 | qreal colPosAt(int modelIndex) const; | - | ||||||||||||||||||||||||||||||
| 125 | qreal rowPosAt(int modelIndex) const; | - | ||||||||||||||||||||||||||||||
| 126 | qreal snapPosAt(qreal pos) const; | - | ||||||||||||||||||||||||||||||
| 127 | FxViewItem *snapItemAt(qreal pos) const; | - | ||||||||||||||||||||||||||||||
| 128 | int snapIndex() const; | - | ||||||||||||||||||||||||||||||
| 129 | qreal contentXForPosition(qreal pos) const; | - | ||||||||||||||||||||||||||||||
| 130 | qreal contentYForPosition(qreal pos) const; | - | ||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||
| 132 | void resetColumns(); | - | ||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||
| 134 | bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override; | - | ||||||||||||||||||||||||||||||
| 135 | bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override; | - | ||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||
| 137 | void removeItem(FxViewItem *item); | - | ||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||
| 139 | FxViewItem *newViewItem(int index, QQuickItem *item) override; | - | ||||||||||||||||||||||||||||||
| 140 | void initializeViewItem(FxViewItem *item) override; | - | ||||||||||||||||||||||||||||||
| 141 | void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override; | - | ||||||||||||||||||||||||||||||
| 142 | void repositionPackageItemAt(QQuickItem *item, int index) override; | - | ||||||||||||||||||||||||||||||
| 143 | void resetFirstItemPosition(qreal pos = 0.0) override; | - | ||||||||||||||||||||||||||||||
| 144 | void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) override; | - | ||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||
| 146 | void createHighlight() override; | - | ||||||||||||||||||||||||||||||
| 147 | void updateHighlight() override; | - | ||||||||||||||||||||||||||||||
| 148 | void resetHighlightPosition() override; | - | ||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||
| 150 | void setPosition(qreal pos) override; | - | ||||||||||||||||||||||||||||||
| 151 | void layoutVisibleItems(int fromModelIndex = 0) override; | - | ||||||||||||||||||||||||||||||
| 152 | bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) override; | - | ||||||||||||||||||||||||||||||
| 153 | void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) override; | - | ||||||||||||||||||||||||||||||
| 154 | bool needsRefillForAddedOrRemovedIndex(int index) const override; | - | ||||||||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||||||||
| 156 | qreal headerSize() const override; | - | ||||||||||||||||||||||||||||||
| 157 | qreal footerSize() const override; | - | ||||||||||||||||||||||||||||||
| 158 | bool showHeaderForIndex(int index) const override; | - | ||||||||||||||||||||||||||||||
| 159 | bool showFooterForIndex(int index) const override; | - | ||||||||||||||||||||||||||||||
| 160 | void updateHeader() override; | - | ||||||||||||||||||||||||||||||
| 161 | void updateFooter() override; | - | ||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||
| 163 | void changedVisibleIndex(int newIndex) override; | - | ||||||||||||||||||||||||||||||
| 164 | void initializeCurrentItem() override; | - | ||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||
| 166 | void updateViewport() override; | - | ||||||||||||||||||||||||||||||
| 167 | void fixupPosition() override; | - | ||||||||||||||||||||||||||||||
| 168 | void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override; | - | ||||||||||||||||||||||||||||||
| 169 | bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||||||||||||||||||||||||||
| 170 | QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) override; | - | ||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||
| 172 | QQuickGridView::Flow flow; | - | ||||||||||||||||||||||||||||||
| 173 | qreal cellWidth; | - | ||||||||||||||||||||||||||||||
| 174 | qreal cellHeight; | - | ||||||||||||||||||||||||||||||
| 175 | int columns; | - | ||||||||||||||||||||||||||||||
| 176 | QQuickGridView::SnapMode snapMode; | - | ||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||
| 178 | QSmoothedAnimation *highlightXAnimator; | - | ||||||||||||||||||||||||||||||
| 179 | QSmoothedAnimation *highlightYAnimator; | - | ||||||||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||||||||
| 181 | QQuickGridViewPrivate() | - | ||||||||||||||||||||||||||||||
| 182 | : flow(QQuickGridView::FlowLeftToRight) | - | ||||||||||||||||||||||||||||||
| 183 | , cellWidth(100), cellHeight(100), columns(1) | - | ||||||||||||||||||||||||||||||
| 184 | , snapMode(QQuickGridView::NoSnap) | - | ||||||||||||||||||||||||||||||
| 185 | , highlightXAnimator(nullptr), highlightYAnimator(nullptr) | - | ||||||||||||||||||||||||||||||
| 186 | {} executed 1782 times by 4 tests: end of blockExecuted by:
| 1782 | ||||||||||||||||||||||||||||||
| 187 | ~QQuickGridViewPrivate() | - | ||||||||||||||||||||||||||||||
| 188 | { | - | ||||||||||||||||||||||||||||||
| 189 | delete highlightXAnimator; | - | ||||||||||||||||||||||||||||||
| 190 | delete highlightYAnimator; | - | ||||||||||||||||||||||||||||||
| 191 | } executed 1782 times by 4 tests: end of blockExecuted by:
| 1782 | ||||||||||||||||||||||||||||||
| 192 | }; | - | ||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||
| 194 | Qt::Orientation QQuickGridViewPrivate::layoutOrientation() const | - | ||||||||||||||||||||||||||||||
| 195 | { | - | ||||||||||||||||||||||||||||||
| 196 | return executed 384171 times by 4 tests: flow == QQuickGridView::FlowLeftToRight ? Qt::Vertical : Qt::Horizontal;return flow == QQuickGridView::FlowLeftToRight ? Qt::Vertical : Qt::Horizontal;Executed by:
executed 384171 times by 4 tests: return flow == QQuickGridView::FlowLeftToRight ? Qt::Vertical : Qt::Horizontal;Executed by:
| 384171 | ||||||||||||||||||||||||||||||
| 197 | } | - | ||||||||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||||||||
| 199 | bool QQuickGridViewPrivate::isContentFlowReversed() const | - | ||||||||||||||||||||||||||||||
| 200 | { | - | ||||||||||||||||||||||||||||||
| 201 | const QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||
| 203 | return executed 204260 times by 4 tests: (flow == QQuickGridView::FlowLeftToRight && verticalLayoutDirection == QQuickItemView::BottomToTop)return (flow == QQuickGridView::FlowLeftToRight && verticalLayoutDirection == QQuickItemView::BottomToTop) || (flow == QQuickGridView::FlowTopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft);Executed by:
executed 204260 times by 4 tests: return (flow == QQuickGridView::FlowLeftToRight && verticalLayoutDirection == QQuickItemView::BottomToTop) || (flow == QQuickGridView::FlowTopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft);Executed by:
| 204260 | ||||||||||||||||||||||||||||||
| 204 | || (flow == QQuickGridView::FlowTopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft); executed 204260 times by 4 tests: return (flow == QQuickGridView::FlowLeftToRight && verticalLayoutDirection == QQuickItemView::BottomToTop) || (flow == QQuickGridView::FlowTopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft);Executed by:
| 204260 | ||||||||||||||||||||||||||||||
| 205 | } | - | ||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||
| 207 | void QQuickGridViewPrivate::changedVisibleIndex(int newIndex) | - | ||||||||||||||||||||||||||||||
| 208 | { | - | ||||||||||||||||||||||||||||||
| 209 | visibleIndex = newIndex / columns * columns; | - | ||||||||||||||||||||||||||||||
| 210 | } executed 56 times by 1 test: end of blockExecuted by:
| 56 | ||||||||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||||||||
| 212 | void QQuickGridViewPrivate::setPosition(qreal pos) | - | ||||||||||||||||||||||||||||||
| 213 | { | - | ||||||||||||||||||||||||||||||
| 214 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 215 | q->QQuickFlickable::setContentX(contentXForPosition(pos)); | - | ||||||||||||||||||||||||||||||
| 216 | q->QQuickFlickable::setContentY(contentYForPosition(pos)); | - | ||||||||||||||||||||||||||||||
| 217 | } executed 4555 times by 4 tests: end of blockExecuted by:
| 4555 | ||||||||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||||||||
| 219 | qreal QQuickGridViewPrivate::originPosition() const | - | ||||||||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||||||||
| 221 | qreal pos = 0; | - | ||||||||||||||||||||||||||||||
| 222 | if (!visibleItems.isEmpty()
| 11274-22995 | ||||||||||||||||||||||||||||||
| 223 | pos = static_cast<FxGridItemSG*>(visibleItems.first())->rowPos() - visibleIndex / columns * rowSize(); executed 22995 times by 4 tests: pos = static_cast<FxGridItemSG*>(visibleItems.first())->rowPos() - visibleIndex / columns * rowSize();Executed by:
| 22995 | ||||||||||||||||||||||||||||||
| 224 | return executed 34269 times by 4 tests: pos;return pos;Executed by:
executed 34269 times by 4 tests: return pos;Executed by:
| 34269 | ||||||||||||||||||||||||||||||
| 225 | } | - | ||||||||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||||||||
| 227 | qreal QQuickGridViewPrivate::lastPosition() const | - | ||||||||||||||||||||||||||||||
| 228 | { | - | ||||||||||||||||||||||||||||||
| 229 | qreal pos = 0; | - | ||||||||||||||||||||||||||||||
| 230 | if (model && (model->count()
| 2-23701 | ||||||||||||||||||||||||||||||
| 231 | qreal lastRowPos = model->count()
| 2-23701 | ||||||||||||||||||||||||||||||
| 232 | if (!visibleItems.isEmpty()
| 3960-19743 | ||||||||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||||||||
| 234 | lastRowPos = qMax(lastRowPos, static_cast<FxGridItemSG*>(visibleItems.last())->rowPos()); | - | ||||||||||||||||||||||||||||||
| 235 | } executed 19743 times by 4 tests: end of blockExecuted by:
| 19743 | ||||||||||||||||||||||||||||||
| 236 | pos = lastRowPos + rowSize(); | - | ||||||||||||||||||||||||||||||
| 237 | } executed 23703 times by 4 tests: end of blockExecuted by:
| 23703 | ||||||||||||||||||||||||||||||
| 238 | return executed 24955 times by 4 tests: pos;return pos;Executed by:
executed 24955 times by 4 tests: return pos;Executed by:
| 24955 | ||||||||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||||||||
| 241 | qreal QQuickGridViewPrivate::positionAt(int index) const | - | ||||||||||||||||||||||||||||||
| 242 | { | - | ||||||||||||||||||||||||||||||
| 243 | return executed 12241 times by 4 tests: rowPosAt(index);return rowPosAt(index);Executed by:
executed 12241 times by 4 tests: return rowPosAt(index);Executed by:
| 12241 | ||||||||||||||||||||||||||||||
| 244 | } | - | ||||||||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||||||||
| 246 | qreal QQuickGridViewPrivate::endPositionAt(int index) const | - | ||||||||||||||||||||||||||||||
| 247 | { | - | ||||||||||||||||||||||||||||||
| 248 | return executed 14266 times by 4 tests: rowPosAt(index) + rowSize();return rowPosAt(index) + rowSize();Executed by:
executed 14266 times by 4 tests: return rowPosAt(index) + rowSize();Executed by:
| 14266 | ||||||||||||||||||||||||||||||
| 249 | } | - | ||||||||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||||||||
| 251 | qreal QQuickGridViewPrivate::rowSize() const { | - | ||||||||||||||||||||||||||||||
| 252 | return executed 602888 times by 4 tests: flow == QQuickGridView::FlowLeftToRight ? cellHeight : cellWidth;return flow == QQuickGridView::FlowLeftToRight ? cellHeight : cellWidth;Executed by:
executed 602888 times by 4 tests: return flow == QQuickGridView::FlowLeftToRight ? cellHeight : cellWidth;Executed by:
| 602888 | ||||||||||||||||||||||||||||||
| 253 | } | - | ||||||||||||||||||||||||||||||
| 254 | qreal QQuickGridViewPrivate::colSize() const { | - | ||||||||||||||||||||||||||||||
| 255 | return executed 417056 times by 4 tests: flow == QQuickGridView::FlowLeftToRight ? cellWidth : cellHeight;return flow == QQuickGridView::FlowLeftToRight ? cellWidth : cellHeight;Executed by:
executed 417056 times by 4 tests: return flow == QQuickGridView::FlowLeftToRight ? cellWidth : cellHeight;Executed by:
| 417056 | ||||||||||||||||||||||||||||||
| 256 | } | - | ||||||||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||||||||
| 258 | qreal QQuickGridViewPrivate::colPosAt(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 259 | { | - | ||||||||||||||||||||||||||||||
| 260 | if (FxViewItem *item = visibleItem(modelIndex)
| 2249-24370 | ||||||||||||||||||||||||||||||
| 261 | return executed 24370 times by 4 tests: static_cast<FxGridItemSG*>(item)->colPos();return static_cast<FxGridItemSG*>(item)->colPos();Executed by:
executed 24370 times by 4 tests: return static_cast<FxGridItemSG*>(item)->colPos();Executed by:
| 24370 | ||||||||||||||||||||||||||||||
| 262 | if (!visibleItems.isEmpty()
| 287-1962 | ||||||||||||||||||||||||||||||
| 263 | if (modelIndex == visibleIndex
| 6-281 | ||||||||||||||||||||||||||||||
| 264 | FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.first()); | - | ||||||||||||||||||||||||||||||
| 265 | return executed 6 times by 1 test: firstItem->colPos();return firstItem->colPos();Executed by:
executed 6 times by 1 test: return firstItem->colPos();Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 266 | } else if (modelIndex < visibleIndex
| 85-196 | ||||||||||||||||||||||||||||||
| 267 | int count = (visibleIndex - modelIndex) % columns; | - | ||||||||||||||||||||||||||||||
| 268 | int col = static_cast<FxGridItemSG*>(visibleItems.first())->colPos() / colSize(); | - | ||||||||||||||||||||||||||||||
| 269 | col = (columns - count + col) % columns; | - | ||||||||||||||||||||||||||||||
| 270 | return executed 85 times by 1 test: col * colSize();return col * colSize();Executed by:
executed 85 times by 1 test: return col * colSize();Executed by:
| 85 | ||||||||||||||||||||||||||||||
| 271 | } else { | - | ||||||||||||||||||||||||||||||
| 272 | FxGridItemSG *lastItem = static_cast<FxGridItemSG*>(visibleItems.last()); | - | ||||||||||||||||||||||||||||||
| 273 | int count = modelIndex - lastItem->index; | - | ||||||||||||||||||||||||||||||
| 274 | int col = lastItem->colPos() / colSize(); | - | ||||||||||||||||||||||||||||||
| 275 | col = (col + count) % columns; | - | ||||||||||||||||||||||||||||||
| 276 | return executed 196 times by 1 test: col * colSize();return col * colSize();Executed by:
executed 196 times by 1 test: return col * colSize();Executed by:
| 196 | ||||||||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||||||||
| 278 | } | - | ||||||||||||||||||||||||||||||
| 279 | return executed 1962 times by 3 tests: (modelIndex % columns) * colSize();return (modelIndex % columns) * colSize();Executed by:
executed 1962 times by 3 tests: return (modelIndex % columns) * colSize();Executed by:
| 1962 | ||||||||||||||||||||||||||||||
| 280 | } | - | ||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||
| 282 | qreal QQuickGridViewPrivate::rowPosAt(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 283 | { | - | ||||||||||||||||||||||||||||||
| 284 | if (FxViewItem *item = visibleItem(modelIndex)
| 38790-59550 | ||||||||||||||||||||||||||||||
| 285 | return executed 59550 times by 4 tests: static_cast<FxGridItemSG*>(item)->rowPos();return static_cast<FxGridItemSG*>(item)->rowPos();Executed by:
executed 59550 times by 4 tests: return static_cast<FxGridItemSG*>(item)->rowPos();Executed by:
| 59550 | ||||||||||||||||||||||||||||||
| 286 | if (!visibleItems.isEmpty()
| 15232-23558 | ||||||||||||||||||||||||||||||
| 287 | if (modelIndex == visibleIndex
| 14-23544 | ||||||||||||||||||||||||||||||
| 288 | FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.first()); | - | ||||||||||||||||||||||||||||||
| 289 | return executed 14 times by 1 test: firstItem->rowPos();return firstItem->rowPos();Executed by:
executed 14 times by 1 test: return firstItem->rowPos();Executed by:
| 14 | ||||||||||||||||||||||||||||||
| 290 | } else if (modelIndex < visibleIndex
| 1670-21874 | ||||||||||||||||||||||||||||||
| 291 | FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.first()); | - | ||||||||||||||||||||||||||||||
| 292 | int firstCol = firstItem->colPos() / colSize(); | - | ||||||||||||||||||||||||||||||
| 293 | int col = visibleIndex - modelIndex + (columns - firstCol - 1); | - | ||||||||||||||||||||||||||||||
| 294 | int rows = col / columns; | - | ||||||||||||||||||||||||||||||
| 295 | return executed 1670 times by 1 test: firstItem->rowPos() - rows * rowSize();return firstItem->rowPos() - rows * rowSize();Executed by:
executed 1670 times by 1 test: return firstItem->rowPos() - rows * rowSize();Executed by:
| 1670 | ||||||||||||||||||||||||||||||
| 296 | } else { | - | ||||||||||||||||||||||||||||||
| 297 | FxGridItemSG *lastItem = static_cast<FxGridItemSG*>(visibleItems.last()); | - | ||||||||||||||||||||||||||||||
| 298 | int count = modelIndex - lastItem->index; | - | ||||||||||||||||||||||||||||||
| 299 | int col = lastItem->colPos() + count * colSize(); | - | ||||||||||||||||||||||||||||||
| 300 | int rows = col / (columns * colSize()); | - | ||||||||||||||||||||||||||||||
| 301 | return executed 21874 times by 2 tests: lastItem->rowPos() + rows * rowSize();return lastItem->rowPos() + rows * rowSize();Executed by:
executed 21874 times by 2 tests: return lastItem->rowPos() + rows * rowSize();Executed by:
| 21874 | ||||||||||||||||||||||||||||||
| 302 | } | - | ||||||||||||||||||||||||||||||
| 303 | } | - | ||||||||||||||||||||||||||||||
| 304 | return executed 15232 times by 4 tests: (modelIndex / columns) * rowSize();return (modelIndex / columns) * rowSize();Executed by:
executed 15232 times by 4 tests: return (modelIndex / columns) * rowSize();Executed by:
| 15232 | ||||||||||||||||||||||||||||||
| 305 | } | - | ||||||||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||
| 308 | qreal QQuickGridViewPrivate::snapPosAt(qreal pos) const | - | ||||||||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||||||||
| 310 | const QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 311 | qreal snapPos = 0; | - | ||||||||||||||||||||||||||||||
| 312 | if (!visibleItems.isEmpty()
| 0-138 | ||||||||||||||||||||||||||||||
| 313 | qreal highlightStart = highlightRangeStart; | - | ||||||||||||||||||||||||||||||
| 314 | pos += highlightStart; | - | ||||||||||||||||||||||||||||||
| 315 | pos += rowSize()/2; | - | ||||||||||||||||||||||||||||||
| 316 | snapPos = static_cast<FxGridItemSG*>(visibleItems.first())->rowPos() - visibleIndex / columns * rowSize(); | - | ||||||||||||||||||||||||||||||
| 317 | snapPos = pos - std::fmod(pos - snapPos, qreal(rowSize())); | - | ||||||||||||||||||||||||||||||
| 318 | snapPos -= highlightStart; | - | ||||||||||||||||||||||||||||||
| 319 | qreal maxExtent; | - | ||||||||||||||||||||||||||||||
| 320 | qreal minExtent; | - | ||||||||||||||||||||||||||||||
| 321 | if (isContentFlowReversed()
| 46-92 | ||||||||||||||||||||||||||||||
| 322 | maxExtent = q->minXExtent()-size(); | - | ||||||||||||||||||||||||||||||
| 323 | minExtent = q->maxXExtent()-size(); | - | ||||||||||||||||||||||||||||||
| 324 | } executed 46 times by 1 test: else {end of blockExecuted by:
| 46 | ||||||||||||||||||||||||||||||
| 325 | maxExtent = flow == QQuickGridView::FlowLeftToRight
| 46 | ||||||||||||||||||||||||||||||
| 326 | minExtent = flow == QQuickGridView::FlowLeftToRight
| 46 | ||||||||||||||||||||||||||||||
| 327 | } executed 92 times by 1 test: end of blockExecuted by:
| 92 | ||||||||||||||||||||||||||||||
| 328 | if (snapPos > maxExtent
| 0-138 | ||||||||||||||||||||||||||||||
| 329 | snapPos = maxExtent; never executed: snapPos = maxExtent; | 0 | ||||||||||||||||||||||||||||||
| 330 | if (snapPos < minExtent
| 6-132 | ||||||||||||||||||||||||||||||
| 331 | snapPos = minExtent; executed 6 times by 1 test: snapPos = minExtent;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 332 | } executed 138 times by 1 test: end of blockExecuted by:
| 138 | ||||||||||||||||||||||||||||||
| 333 | return executed 138 times by 1 test: snapPos;return snapPos;Executed by:
executed 138 times by 1 test: return snapPos;Executed by:
| 138 | ||||||||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||
| 336 | FxViewItem *QQuickGridViewPrivate::snapItemAt(qreal pos) const | - | ||||||||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||||||||
| 338 | for (FxViewItem *item : visibleItems) { | - | ||||||||||||||||||||||||||||||
| 339 | if (item->index == -1
| 0-3988 | ||||||||||||||||||||||||||||||
| 340 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 341 | qreal itemTop = item->position(); | - | ||||||||||||||||||||||||||||||
| 342 | if (itemTop+rowSize()/2 >= pos
| 48-3416 | ||||||||||||||||||||||||||||||
| 343 | return executed 524 times by 1 test: item;return item;Executed by:
executed 524 times by 1 test: return item;Executed by:
| 524 | ||||||||||||||||||||||||||||||
| 344 | } executed 3464 times by 1 test: end of blockExecuted by:
| 3464 | ||||||||||||||||||||||||||||||
| 345 | return executed 172 times by 1 test: nullptr;return nullptr;Executed by:
executed 172 times by 1 test: return nullptr;Executed by:
| 172 | ||||||||||||||||||||||||||||||
| 346 | } | - | ||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||
| 348 | int QQuickGridViewPrivate::snapIndex() const | - | ||||||||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||||||||
| 350 | int index = currentIndex; | - | ||||||||||||||||||||||||||||||
| 351 | for (FxViewItem *item : visibleItems) { | - | ||||||||||||||||||||||||||||||
| 352 | if (item->index == -1
| 0-23356 | ||||||||||||||||||||||||||||||
| 353 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 354 | qreal itemTop = item->position(); | - | ||||||||||||||||||||||||||||||
| 355 | FxGridItemSG *hItem = static_cast<FxGridItemSG*>(highlight); | - | ||||||||||||||||||||||||||||||
| 356 | if (itemTop >= hItem->rowPos()-rowSize()/2
| 344-20627 | ||||||||||||||||||||||||||||||
| 357 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(item); | - | ||||||||||||||||||||||||||||||
| 358 | index = gridItem->index; | - | ||||||||||||||||||||||||||||||
| 359 | if (gridItem->colPos() >= hItem->colPos()-colSize()/2
| 0-2385 | ||||||||||||||||||||||||||||||
| 360 | return executed 2385 times by 1 test: gridItem->index;return gridItem->index;Executed by:
executed 2385 times by 1 test: return gridItem->index;Executed by:
| 2385 | ||||||||||||||||||||||||||||||
| 361 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 362 | } executed 20971 times by 1 test: end of blockExecuted by:
| 20971 | ||||||||||||||||||||||||||||||
| 363 | return executed 87 times by 1 test: index;return index;Executed by:
executed 87 times by 1 test: return index;Executed by:
| 87 | ||||||||||||||||||||||||||||||
| 364 | } | - | ||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | qreal QQuickGridViewPrivate::contentXForPosition(qreal pos) const | - | ||||||||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||||||||
| 368 | const QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 369 | if (flow == QQuickGridView::FlowLeftToRight
| 1512-4757 | ||||||||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||||||||
| 371 | if (q->effectiveLayoutDirection() == Qt::LeftToRight
| 593-4164 | ||||||||||||||||||||||||||||||
| 372 | return executed 4164 times by 4 tests: 0;return 0;Executed by:
executed 4164 times by 4 tests: return 0;Executed by:
| 4164 | ||||||||||||||||||||||||||||||
| 373 | } else { | - | ||||||||||||||||||||||||||||||
| 374 | qreal colSize = cellWidth; | - | ||||||||||||||||||||||||||||||
| 375 | int columns = q->width()/colSize; | - | ||||||||||||||||||||||||||||||
| 376 | return executed 593 times by 1 test: -q->width() + (cellWidth * columns);return -q->width() + (cellWidth * columns);Executed by:
executed 593 times by 1 test: return -q->width() + (cellWidth * columns);Executed by:
| 593 | ||||||||||||||||||||||||||||||
| 377 | } | - | ||||||||||||||||||||||||||||||
| 378 | } else { | - | ||||||||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||||||||
| 380 | if (q->effectiveLayoutDirection() == Qt::LeftToRight
| 690-822 | ||||||||||||||||||||||||||||||
| 381 | return executed 690 times by 1 test: pos;return pos;Executed by:
executed 690 times by 1 test: return pos;Executed by:
| 690 | ||||||||||||||||||||||||||||||
| 382 | else | - | ||||||||||||||||||||||||||||||
| 383 | return executed 822 times by 1 test: -pos - q->width();return -pos - q->width();Executed by:
executed 822 times by 1 test: return -pos - q->width();Executed by:
| 822 | ||||||||||||||||||||||||||||||
| 384 | } | - | ||||||||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||
| 387 | qreal QQuickGridViewPrivate::contentYForPosition(qreal pos) const | - | ||||||||||||||||||||||||||||||
| 388 | { | - | ||||||||||||||||||||||||||||||
| 389 | const QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 390 | if (flow == QQuickGridView::FlowLeftToRight
| 1512-4763 | ||||||||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||||||||
| 392 | if (verticalLayoutDirection == QQuickItemView::TopToBottom
| 573-4190 | ||||||||||||||||||||||||||||||
| 393 | return executed 4190 times by 4 tests: pos;return pos;Executed by:
executed 4190 times by 4 tests: return pos;Executed by:
| 4190 | ||||||||||||||||||||||||||||||
| 394 | else | - | ||||||||||||||||||||||||||||||
| 395 | return executed 573 times by 1 test: -pos - q->height();return -pos - q->height();Executed by:
executed 573 times by 1 test: return -pos - q->height();Executed by:
| 573 | ||||||||||||||||||||||||||||||
| 396 | } else { | - | ||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||
| 398 | if (verticalLayoutDirection == QQuickItemView::TopToBottom
| 568-944 | ||||||||||||||||||||||||||||||
| 399 | return executed 944 times by 1 test: 0;return 0;Executed by:
executed 944 times by 1 test: return 0;Executed by:
| 944 | ||||||||||||||||||||||||||||||
| 400 | else | - | ||||||||||||||||||||||||||||||
| 401 | return executed 568 times by 1 test: -q->height();return -q->height();Executed by:
executed 568 times by 1 test: return -q->height();Executed by:
| 568 | ||||||||||||||||||||||||||||||
| 402 | } | - | ||||||||||||||||||||||||||||||
| 403 | } | - | ||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||
| 405 | void QQuickGridViewPrivate::resetColumns() | - | ||||||||||||||||||||||||||||||
| 406 | { | - | ||||||||||||||||||||||||||||||
| 407 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 408 | qreal length = flow == QQuickGridView::FlowLeftToRight
| 4360-14283 | ||||||||||||||||||||||||||||||
| 409 | columns = qMax(1, qFloor(length / colSize())); | - | ||||||||||||||||||||||||||||||
| 410 | } executed 18643 times by 4 tests: end of blockExecuted by:
| 18643 | ||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||
| 412 | FxViewItem *QQuickGridViewPrivate::newViewItem(int modelIndex, QQuickItem *item) | - | ||||||||||||||||||||||||||||||
| 413 | { | - | ||||||||||||||||||||||||||||||
| 414 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 415 | (void)modelIndex;; | - | ||||||||||||||||||||||||||||||
| 416 | return executed 49543 times by 4 tests: new FxGridItemSG(item, q, false);return new FxGridItemSG(item, q, false);Executed by:
executed 49543 times by 4 tests: return new FxGridItemSG(item, q, false);Executed by:
| 49543 | ||||||||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||
| 419 | void QQuickGridViewPrivate::initializeViewItem(FxViewItem *item) | - | ||||||||||||||||||||||||||||||
| 420 | { | - | ||||||||||||||||||||||||||||||
| 421 | QQuickItemViewPrivate::initializeViewItem(item); | - | ||||||||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||||||||
| 424 | item->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 425 | } executed 49543 times by 4 tests: end of blockExecuted by:
| 49543 | ||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||
| 427 | bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) | - | ||||||||||||||||||||||||||||||
| 428 | { | - | ||||||||||||||||||||||||||||||
| 429 | qreal colPos = colPosAt(visibleIndex); | - | ||||||||||||||||||||||||||||||
| 430 | qreal rowPos = rowPosAt(visibleIndex); | - | ||||||||||||||||||||||||||||||
| 431 | if (visibleItems.count()
| 1954-21513 | ||||||||||||||||||||||||||||||
| 432 | FxGridItemSG *lastItem = static_cast<FxGridItemSG*>(visibleItems.constLast()); | - | ||||||||||||||||||||||||||||||
| 433 | rowPos = lastItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 434 | int colNum = qFloor((lastItem->colPos()+colSize()/2) / colSize()); | - | ||||||||||||||||||||||||||||||
| 435 | if (++
| 7893-13620 | ||||||||||||||||||||||||||||||
| 436 | colNum = 0; | - | ||||||||||||||||||||||||||||||
| 437 | rowPos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 438 | } executed 13620 times by 4 tests: end of blockExecuted by:
| 13620 | ||||||||||||||||||||||||||||||
| 439 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 440 | } executed 21513 times by 4 tests: end of blockExecuted by:
| 21513 | ||||||||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||||||||
| 442 | int modelIndex = findLastVisibleIndex(); | - | ||||||||||||||||||||||||||||||
| 443 | modelIndex = modelIndex < 0
| 1958-21509 | ||||||||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||||||||
| 445 | if (visibleItems.count()
| 0-21513 | ||||||||||||||||||||||||||||||
| 446 | || bufferTo < rowPosAt(visibleIndex) - rowSize()
| 6-21507 | ||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||||||||
| 449 | int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns; | - | ||||||||||||||||||||||||||||||
| 450 | releaseVisibleItems(); | - | ||||||||||||||||||||||||||||||
| 451 | modelIndex += count; | - | ||||||||||||||||||||||||||||||
| 452 | if (modelIndex >= model->count()
| 0-6 | ||||||||||||||||||||||||||||||
| 453 | modelIndex = model->count() - 1; never executed: modelIndex = model->count() - 1; | 0 | ||||||||||||||||||||||||||||||
| 454 | else if (modelIndex < 0
| 2-4 | ||||||||||||||||||||||||||||||
| 455 | modelIndex = 0; executed 2 times by 1 test: modelIndex = 0;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 456 | modelIndex = modelIndex / columns * columns; | - | ||||||||||||||||||||||||||||||
| 457 | visibleIndex = modelIndex; | - | ||||||||||||||||||||||||||||||
| 458 | colPos = colPosAt(visibleIndex); | - | ||||||||||||||||||||||||||||||
| 459 | rowPos = rowPosAt(visibleIndex); | - | ||||||||||||||||||||||||||||||
| 460 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||||||||
| 462 | int colNum = qFloor((colPos+colSize()/2) / colSize()); | - | ||||||||||||||||||||||||||||||
| 463 | FxGridItemSG *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 464 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||
| 466 | QQmlIncubator::IncubationMode incubationMode = doBuffer
| 6895-16572 | ||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||
| 468 | while (modelIndex < model->count()
| 11039-53610 | ||||||||||||||||||||||||||||||
| 469 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 517, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: append item" << modelIndex << colPos << rowPos; | 0-41802 | ||||||||||||||||||||||||||||||
| 470 | if (!(item = static_cast<FxGridItemSG*>(createItem(modelIndex, incubationMode)))
| 620-41182 | ||||||||||||||||||||||||||||||
| 471 | break; executed 620 times by 1 test: break;Executed by:
| 620 | ||||||||||||||||||||||||||||||
| 472 | if (!transitioner
| 266-36648 | ||||||||||||||||||||||||||||||
| 473 | item->setPosition(colPos, rowPos, true); executed 40916 times by 3 tests: item->setPosition(colPos, rowPos, true);Executed by:
| 40916 | ||||||||||||||||||||||||||||||
| 474 | QQuickItemPrivate::get(item->item)->setCulled(doBuffer); | - | ||||||||||||||||||||||||||||||
| 475 | visibleItems.append(item); | - | ||||||||||||||||||||||||||||||
| 476 | if (++
| 11151-30031 | ||||||||||||||||||||||||||||||
| 477 | colNum = 0; | - | ||||||||||||||||||||||||||||||
| 478 | rowPos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 479 | } executed 11151 times by 3 tests: end of blockExecuted by:
| 11151 | ||||||||||||||||||||||||||||||
| 480 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 481 | ++modelIndex; | - | ||||||||||||||||||||||||||||||
| 482 | changed = true; | - | ||||||||||||||||||||||||||||||
| 483 | } executed 41182 times by 3 tests: end of blockExecuted by:
| 41182 | ||||||||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||||||||
| 485 | if (doBuffer
| 590-16572 | ||||||||||||||||||||||||||||||
| 486 | return executed 590 times by 1 test: changed;return changed;Executed by:
executed 590 times by 1 test: return changed;Executed by:
| 590 | ||||||||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||||||||
| 489 | if (visibleItems.count()
| 6-22871 | ||||||||||||||||||||||||||||||
| 490 | FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 491 | rowPos = firstItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 492 | colPos = firstItem->colPos(); | - | ||||||||||||||||||||||||||||||
| 493 | } executed 22871 times by 4 tests: end of blockExecuted by:
| 22871 | ||||||||||||||||||||||||||||||
| 494 | colNum = qFloor((colPos+colSize()/2) / colSize()); | - | ||||||||||||||||||||||||||||||
| 495 | if (--
| 1775-21102 | ||||||||||||||||||||||||||||||
| 496 | colNum = columns - 1; | - | ||||||||||||||||||||||||||||||
| 497 | rowPos -= rowSize(); | - | ||||||||||||||||||||||||||||||
| 498 | } executed 21102 times by 4 tests: end of blockExecuted by:
| 21102 | ||||||||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||
| 501 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 502 | while (visibleIndex > 0
| 1919-17876 | ||||||||||||||||||||||||||||||
| 503 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 551, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: prepend item" << visibleIndex-1 << "top pos" << rowPos << colPos; | 0-1919 | ||||||||||||||||||||||||||||||
| 504 | if (!(item = static_cast<FxGridItemSG*>(createItem(visibleIndex-1, incubationMode)))
| 222-1697 | ||||||||||||||||||||||||||||||
| 505 | break; executed 222 times by 1 test: break;Executed by:
| 222 | ||||||||||||||||||||||||||||||
| 506 | --visibleIndex; | - | ||||||||||||||||||||||||||||||
| 507 | if (!transitioner
| 0-1677 | ||||||||||||||||||||||||||||||
| 508 | item->setPosition(colPos, rowPos, true); executed 1697 times by 1 test: item->setPosition(colPos, rowPos, true);Executed by:
| 1697 | ||||||||||||||||||||||||||||||
| 509 | QQuickItemPrivate::get(item->item)->setCulled(doBuffer); | - | ||||||||||||||||||||||||||||||
| 510 | visibleItems.prepend(item); | - | ||||||||||||||||||||||||||||||
| 511 | if (--
| 537-1160 | ||||||||||||||||||||||||||||||
| 512 | colNum = columns-1; | - | ||||||||||||||||||||||||||||||
| 513 | rowPos -= rowSize(); | - | ||||||||||||||||||||||||||||||
| 514 | } executed 537 times by 1 test: end of blockExecuted by:
| 537 | ||||||||||||||||||||||||||||||
| 515 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 516 | changed = true; | - | ||||||||||||||||||||||||||||||
| 517 | } executed 1697 times by 1 test: end of blockExecuted by:
| 1697 | ||||||||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||||||||
| 519 | return executed 22877 times by 4 tests: changed;return changed;Executed by:
executed 22877 times by 4 tests: return changed;Executed by:
| 22877 | ||||||||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||
| 522 | void QQuickGridViewPrivate::removeItem(FxViewItem *item) | - | ||||||||||||||||||||||||||||||
| 523 | { | - | ||||||||||||||||||||||||||||||
| 524 | if (item->transitionScheduledOrRunning()
| 178-5872 | ||||||||||||||||||||||||||||||
| 525 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 573, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "\tnot releasing animating item:" << item->index << item->item->objectName(); | 0-178 | ||||||||||||||||||||||||||||||
| 526 | item->releaseAfterTransition = true; | - | ||||||||||||||||||||||||||||||
| 527 | releasePendingTransition.append(item); | - | ||||||||||||||||||||||||||||||
| 528 | } executed 178 times by 1 test: else {end of blockExecuted by:
| 178 | ||||||||||||||||||||||||||||||
| 529 | releaseItem(item); | - | ||||||||||||||||||||||||||||||
| 530 | } executed 5872 times by 1 test: end of blockExecuted by:
| 5872 | ||||||||||||||||||||||||||||||
| 531 | } | - | ||||||||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||||||||
| 533 | bool QQuickGridViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) | - | ||||||||||||||||||||||||||||||
| 534 | { | - | ||||||||||||||||||||||||||||||
| 535 | FxGridItemSG *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 536 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||||||||
| 538 | while (visibleItems.count() > 1
| 114-20325 | ||||||||||||||||||||||||||||||
| 539 | && (
| 0-20325 | ||||||||||||||||||||||||||||||
| 540 | && item->rowPos()+rowSize()-1 < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)
| 3867-16458 | ||||||||||||||||||||||||||||||
| 541 | if (item->attached->delayRemove()
| 0-3867 | ||||||||||||||||||||||||||||||
| 542 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 543 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 591, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: remove first" << visibleIndex << "top end pos" << item->endRowPos(); | 0-3867 | ||||||||||||||||||||||||||||||
| 544 | if (item->index != -1
| 0-3867 | ||||||||||||||||||||||||||||||
| 545 | visibleIndex++; executed 3867 times by 1 test: visibleIndex++;Executed by:
| 3867 | ||||||||||||||||||||||||||||||
| 546 | visibleItems.removeFirst(); | - | ||||||||||||||||||||||||||||||
| 547 | removeItem(item); | - | ||||||||||||||||||||||||||||||
| 548 | changed = true; | - | ||||||||||||||||||||||||||||||
| 549 | } executed 3867 times by 1 test: end of blockExecuted by:
| 3867 | ||||||||||||||||||||||||||||||
| 550 | while (visibleItems.count() > 1
| 114-18640 | ||||||||||||||||||||||||||||||
| 551 | && (
| 0-18640 | ||||||||||||||||||||||||||||||
| 552 | && item->rowPos() > bufferTo + rowSize()*(columns - item->colPos()/colSize())/(columns+1)
| 2182-16458 | ||||||||||||||||||||||||||||||
| 553 | if (item->attached->delayRemove()
| 0-2182 | ||||||||||||||||||||||||||||||
| 554 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 555 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 603, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: remove last" << visibleIndex+visibleItems.count()-1; | 0-2182 | ||||||||||||||||||||||||||||||
| 556 | visibleItems.removeLast(); | - | ||||||||||||||||||||||||||||||
| 557 | removeItem(item); | - | ||||||||||||||||||||||||||||||
| 558 | changed = true; | - | ||||||||||||||||||||||||||||||
| 559 | } executed 2182 times by 1 test: end of blockExecuted by:
| 2182 | ||||||||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||||||||
| 561 | return executed 16572 times by 4 tests: changed;return changed;Executed by:
executed 16572 times by 4 tests: return changed;Executed by:
| 16572 | ||||||||||||||||||||||||||||||
| 562 | } | - | ||||||||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||||||||
| 564 | void QQuickGridViewPrivate::updateViewport() | - | ||||||||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||||||||
| 566 | resetColumns(); | - | ||||||||||||||||||||||||||||||
| 567 | QQuickItemViewPrivate::updateViewport(); | - | ||||||||||||||||||||||||||||||
| 568 | } executed 14899 times by 4 tests: end of blockExecuted by:
| 14899 | ||||||||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||||||||
| 570 | void QQuickGridViewPrivate::layoutVisibleItems(int fromModelIndex) | - | ||||||||||||||||||||||||||||||
| 571 | { | - | ||||||||||||||||||||||||||||||
| 572 | if (visibleItems.count()
| 62-4174 | ||||||||||||||||||||||||||||||
| 573 | const qreal from = isContentFlowReversed()
| 1389-2785 | ||||||||||||||||||||||||||||||
| 574 | const qreal to = isContentFlowReversed()
| 1389-2785 | ||||||||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||||||||
| 576 | FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 577 | qreal rowPos = firstItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 578 | qreal colPos = firstItem->colPos(); | - | ||||||||||||||||||||||||||||||
| 579 | int col = visibleIndex % columns; | - | ||||||||||||||||||||||||||||||
| 580 | if (colPos != col * colSize()
| 212-3962 | ||||||||||||||||||||||||||||||
| 581 | colPos = col * colSize(); | - | ||||||||||||||||||||||||||||||
| 582 | firstItem->setPosition(colPos, rowPos); | - | ||||||||||||||||||||||||||||||
| 583 | } executed 212 times by 1 test: end of blockExecuted by:
| 212 | ||||||||||||||||||||||||||||||
| 584 | firstItem->setVisible(firstItem->rowPos() + rowSize() >= from && firstItem->rowPos() <= to); | - | ||||||||||||||||||||||||||||||
| 585 | for (int i = 1; i < visibleItems.count()
| 4174-72706 | ||||||||||||||||||||||||||||||
| 586 | FxGridItemSG *item = static_cast<FxGridItemSG*>(visibleItems.at(i)); | - | ||||||||||||||||||||||||||||||
| 587 | if (++
| 19077-53629 | ||||||||||||||||||||||||||||||
| 588 | col = 0; | - | ||||||||||||||||||||||||||||||
| 589 | rowPos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 590 | } executed 19077 times by 3 tests: end of blockExecuted by:
| 19077 | ||||||||||||||||||||||||||||||
| 591 | colPos = col * colSize(); | - | ||||||||||||||||||||||||||||||
| 592 | if (item->index >= fromModelIndex
| 3858-68848 | ||||||||||||||||||||||||||||||
| 593 | item->setPosition(colPos, rowPos); | - | ||||||||||||||||||||||||||||||
| 594 | item->setVisible(item->rowPos() + rowSize() >= from && item->rowPos() <= to); | - | ||||||||||||||||||||||||||||||
| 595 | } executed 68848 times by 4 tests: end of blockExecuted by:
| 68848 | ||||||||||||||||||||||||||||||
| 596 | } executed 72706 times by 4 tests: end of blockExecuted by:
| 72706 | ||||||||||||||||||||||||||||||
| 597 | } executed 4174 times by 4 tests: end of blockExecuted by:
| 4174 | ||||||||||||||||||||||||||||||
| 598 | } executed 4236 times by 4 tests: end of blockExecuted by:
| 4236 | ||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||
| 600 | void QQuickGridViewPrivate::repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) | - | ||||||||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||||||||
| 602 | int count = sizeBuffer / rowSize(); | - | ||||||||||||||||||||||||||||||
| 603 | static_cast<FxGridItemSG *>(item)->setPosition(colPosAt(index + count), rowPosAt(index + count)); | - | ||||||||||||||||||||||||||||||
| 604 | } executed 126 times by 1 test: end of blockExecuted by:
| 126 | ||||||||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||||||||
| 606 | void QQuickGridViewPrivate::repositionPackageItemAt(QQuickItem *item, int index) | - | ||||||||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||||||||
| 608 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 609 | qreal pos = position(); | - | ||||||||||||||||||||||||||||||
| 610 | if (flow == QQuickGridView::FlowLeftToRight
| 0-28 | ||||||||||||||||||||||||||||||
| 611 | if (item->y() + item->height() > pos
| 0-28 | ||||||||||||||||||||||||||||||
| 612 | qreal y = (
| 0-28 | ||||||||||||||||||||||||||||||
| 613 | ? rowPosAt(index) | - | ||||||||||||||||||||||||||||||
| 614 | : -rowPosAt(index) - item->height(); | - | ||||||||||||||||||||||||||||||
| 615 | item->setPosition(QPointF(colPosAt(index), y)); | - | ||||||||||||||||||||||||||||||
| 616 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||||||||
| 617 | } executed 28 times by 1 test: else {end of blockExecuted by:
| 28 | ||||||||||||||||||||||||||||||
| 618 | if (item->x() + item->width() > pos
| 0 | ||||||||||||||||||||||||||||||
| 619 | qreal y = (
| 0 | ||||||||||||||||||||||||||||||
| 620 | ? colPosAt(index) | - | ||||||||||||||||||||||||||||||
| 621 | : -colPosAt(index) - item->height(); | - | ||||||||||||||||||||||||||||||
| 622 | if (flow == QQuickGridView::FlowTopToBottom
| 0 | ||||||||||||||||||||||||||||||
| 623 | item->setPosition(QPointF(-rowPosAt(index)-item->width(), y)); never executed: item->setPosition(QPointF(-rowPosAt(index)-item->width(), y)); | 0 | ||||||||||||||||||||||||||||||
| 624 | else | - | ||||||||||||||||||||||||||||||
| 625 | item->setPosition(QPointF(rowPosAt(index), y)); never executed: item->setPosition(QPointF(rowPosAt(index), y)); | 0 | ||||||||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||||||||
| 627 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 628 | } | - | ||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||
| 630 | void QQuickGridViewPrivate::resetFirstItemPosition(qreal pos) | - | ||||||||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||||||||
| 632 | FxGridItemSG *item = static_cast<FxGridItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 633 | item->setPosition(0, pos); | - | ||||||||||||||||||||||||||||||
| 634 | } executed 621 times by 3 tests: end of blockExecuted by:
| 621 | ||||||||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||||||||
| 636 | void QQuickGridViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) | - | ||||||||||||||||||||||||||||||
| 637 | { | - | ||||||||||||||||||||||||||||||
| 638 | if (!visibleItems.count()
| 0-1936 | ||||||||||||||||||||||||||||||
| 639 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||||||||
| 641 | int moveCount = (forwards - backwards) / rowSize(); | - | ||||||||||||||||||||||||||||||
| 642 | if (moveCount == 0
| 170-1699 | ||||||||||||||||||||||||||||||
| 643 | moveCount += (changeBeforeVisible % columns) - (columns - 1); executed 170 times by 1 test: moveCount += (changeBeforeVisible % columns) - (columns - 1);Executed by:
| 170 | ||||||||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||||||||
| 645 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 646 | gridItem->setPosition(gridItem->colPos(), gridItem->rowPos() + ((moveCount / columns) * rowSize())); | - | ||||||||||||||||||||||||||||||
| 647 | } executed 1936 times by 1 test: end of blockExecuted by:
| 1936 | ||||||||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||||||||
| 649 | void QQuickGridViewPrivate::createHighlight() | - | ||||||||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||||||||
| 651 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 652 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 653 | if (highlight
| 1986-3934 | ||||||||||||||||||||||||||||||
| 654 | if (trackedItem == highlight
| 0-1986 | ||||||||||||||||||||||||||||||
| 655 | trackedItem = nullptr; executed 1986 times by 4 tests: trackedItem = nullptr;Executed by:
| 1986 | ||||||||||||||||||||||||||||||
| 656 | delete highlight; | - | ||||||||||||||||||||||||||||||
| 657 | highlight = nullptr; | - | ||||||||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||||||||
| 659 | delete highlightXAnimator; | - | ||||||||||||||||||||||||||||||
| 660 | delete highlightYAnimator; | - | ||||||||||||||||||||||||||||||
| 661 | highlightXAnimator = nullptr; | - | ||||||||||||||||||||||||||||||
| 662 | highlightYAnimator = nullptr; | - | ||||||||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||||||||
| 664 | changed = true; | - | ||||||||||||||||||||||||||||||
| 665 | } executed 1986 times by 4 tests: end of blockExecuted by:
| 1986 | ||||||||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||||||||
| 667 | if (currentItem
| 1986-3934 | ||||||||||||||||||||||||||||||
| 668 | QQuickItem *item = createHighlightItem(); | - | ||||||||||||||||||||||||||||||
| 669 | if (item
| 0-1986 | ||||||||||||||||||||||||||||||
| 670 | FxGridItemSG *newHighlight = new FxGridItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 671 | newHighlight->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 672 | if (autoHighlight
| 10-1976 | ||||||||||||||||||||||||||||||
| 673 | resetHighlightPosition(); executed 1976 times by 4 tests: resetHighlightPosition();Executed by:
| 1976 | ||||||||||||||||||||||||||||||
| 674 | highlightXAnimator = new QSmoothedAnimation; | - | ||||||||||||||||||||||||||||||
| 675 | highlightXAnimator->target = QQmlProperty(item, QLatin1String("x")); | - | ||||||||||||||||||||||||||||||
| 676 | highlightXAnimator->userDuration = highlightMoveDuration; | - | ||||||||||||||||||||||||||||||
| 677 | highlightYAnimator = new QSmoothedAnimation; | - | ||||||||||||||||||||||||||||||
| 678 | highlightYAnimator->target = QQmlProperty(item, QLatin1String("y")); | - | ||||||||||||||||||||||||||||||
| 679 | highlightYAnimator->userDuration = highlightMoveDuration; | - | ||||||||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||||||||
| 681 | highlight = newHighlight; | - | ||||||||||||||||||||||||||||||
| 682 | changed = true; | - | ||||||||||||||||||||||||||||||
| 683 | } executed 1986 times by 4 tests: end of blockExecuted by:
| 1986 | ||||||||||||||||||||||||||||||
| 684 | } executed 1986 times by 4 tests: end of blockExecuted by:
| 1986 | ||||||||||||||||||||||||||||||
| 685 | if (changed
| 1950-3970 | ||||||||||||||||||||||||||||||
| 686 | q->highlightItemChanged(); executed 3970 times by 4 tests: q->highlightItemChanged();Executed by:
| 3970 | ||||||||||||||||||||||||||||||
| 687 | } executed 5920 times by 4 tests: end of blockExecuted by:
| 5920 | ||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||
| 689 | void QQuickGridViewPrivate::updateHighlight() | - | ||||||||||||||||||||||||||||||
| 690 | { | - | ||||||||||||||||||||||||||||||
| 691 | applyPendingChanges(); | - | ||||||||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||||||||
| 693 | if ((!currentItem
| 12-9102 | ||||||||||||||||||||||||||||||
| 694 | createHighlight(); executed 2038 times by 4 tests: createHighlight();Executed by:
| 2038 | ||||||||||||||||||||||||||||||
| 695 | bool strictHighlight = haveHighlightRange
| 4-8550 | ||||||||||||||||||||||||||||||
| 696 | if (currentItem
| 0-9102 | ||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | highlightXAnimator->to = currentItem->itemX(); | - | ||||||||||||||||||||||||||||||
| 699 | highlightYAnimator->to = currentItem->itemY(); | - | ||||||||||||||||||||||||||||||
| 700 | highlight->item->setSize(currentItem->item->size()); | - | ||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||
| 702 | highlightXAnimator->restart(); | - | ||||||||||||||||||||||||||||||
| 703 | highlightYAnimator->restart(); | - | ||||||||||||||||||||||||||||||
| 704 | } executed 8978 times by 4 tests: end of blockExecuted by:
| 8978 | ||||||||||||||||||||||||||||||
| 705 | updateTrackedItem(); | - | ||||||||||||||||||||||||||||||
| 706 | } executed 9168 times by 4 tests: end of blockExecuted by:
| 9168 | ||||||||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||||||||
| 708 | void QQuickGridViewPrivate::resetHighlightPosition() | - | ||||||||||||||||||||||||||||||
| 709 | { | - | ||||||||||||||||||||||||||||||
| 710 | if (highlight
| 0-1976 | ||||||||||||||||||||||||||||||
| 711 | FxGridItemSG *cItem = static_cast<FxGridItemSG*>(currentItem); | - | ||||||||||||||||||||||||||||||
| 712 | static_cast<FxGridItemSG*>(highlight)->setPosition(cItem->colPos(), cItem->rowPos()); | - | ||||||||||||||||||||||||||||||
| 713 | } executed 1854 times by 3 tests: end of blockExecuted by:
| 1854 | ||||||||||||||||||||||||||||||
| 714 | } executed 3830 times by 4 tests: end of blockExecuted by:
| 3830 | ||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||
| 716 | qreal QQuickGridViewPrivate::headerSize() const | - | ||||||||||||||||||||||||||||||
| 717 | { | - | ||||||||||||||||||||||||||||||
| 718 | if (!header
| 2688-41523 | ||||||||||||||||||||||||||||||
| 719 | return executed 41523 times by 4 tests: 0.0;return 0.0;Executed by:
executed 41523 times by 4 tests: return 0.0;Executed by:
| 41523 | ||||||||||||||||||||||||||||||
| 720 | return executed 2688 times by 1 test: flow == QQuickGridView::FlowLeftToRight ? header->item->height() : header->item->width();return flow == QQuickGridView::FlowLeftToRight ? header->item->height() : header->item->width();Executed by:
executed 2688 times by 1 test: return flow == QQuickGridView::FlowLeftToRight ? header->item->height() : header->item->width();Executed by:
| 2688 | ||||||||||||||||||||||||||||||
| 721 | } | - | ||||||||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||||||||
| 723 | qreal QQuickGridViewPrivate::footerSize() const | - | ||||||||||||||||||||||||||||||
| 724 | { | - | ||||||||||||||||||||||||||||||
| 725 | if (!footer
| 1335-33518 | ||||||||||||||||||||||||||||||
| 726 | return executed 33518 times by 4 tests: 0.0;return 0.0;Executed by:
executed 33518 times by 4 tests: return 0.0;Executed by:
| 33518 | ||||||||||||||||||||||||||||||
| 727 | return executed 1335 times by 1 test: flow == QQuickGridView::FlowLeftToRight? footer->item->height() : footer->item->width();return flow == QQuickGridView::FlowLeftToRight? footer->item->height() : footer->item->width();Executed by:
executed 1335 times by 1 test: return flow == QQuickGridView::FlowLeftToRight? footer->item->height() : footer->item->width();Executed by:
| 1335 | ||||||||||||||||||||||||||||||
| 728 | } | - | ||||||||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||||||||
| 730 | bool QQuickGridViewPrivate::showHeaderForIndex(int index) const | - | ||||||||||||||||||||||||||||||
| 731 | { | - | ||||||||||||||||||||||||||||||
| 732 | return executed 6031 times by 3 tests: index / columns == 0;return index / columns == 0;Executed by:
executed 6031 times by 3 tests: return index / columns == 0;Executed by:
| 6031 | ||||||||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||||||||
| 735 | bool QQuickGridViewPrivate::showFooterForIndex(int index) const | - | ||||||||||||||||||||||||||||||
| 736 | { | - | ||||||||||||||||||||||||||||||
| 737 | return executed 1028 times by 1 test: index / columns == (model->count()-1) / columns;return index / columns == (model->count()-1) / columns;Executed by:
executed 1028 times by 1 test: return index / columns == (model->count()-1) / columns;Executed by:
| 1028 | ||||||||||||||||||||||||||||||
| 738 | } | - | ||||||||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||||||||
| 740 | void QQuickGridViewPrivate::updateFooter() | - | ||||||||||||||||||||||||||||||
| 741 | { | - | ||||||||||||||||||||||||||||||
| 742 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 743 | bool created = false; | - | ||||||||||||||||||||||||||||||
| 744 | if (!footer
| 483-10626 | ||||||||||||||||||||||||||||||
| 745 | QQuickItem *item = createComponentItem(footerComponent, 1.0); | - | ||||||||||||||||||||||||||||||
| 746 | if (!item
| 86-10540 | ||||||||||||||||||||||||||||||
| 747 | return; executed 10540 times by 4 tests: return;Executed by:
| 10540 | ||||||||||||||||||||||||||||||
| 748 | footer = new FxGridItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 749 | footer->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 750 | created = true; | - | ||||||||||||||||||||||||||||||
| 751 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||||||||
| 753 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(footer); | - | ||||||||||||||||||||||||||||||
| 754 | qreal colOffset = 0; | - | ||||||||||||||||||||||||||||||
| 755 | qreal rowOffset = 0; | - | ||||||||||||||||||||||||||||||
| 756 | if (q->effectiveLayoutDirection() == Qt::RightToLeft
| 192-377 | ||||||||||||||||||||||||||||||
| 757 | if (flow == QQuickGridView::FlowTopToBottom
| 94-98 | ||||||||||||||||||||||||||||||
| 758 | rowOffset += gridItem->item->width() - cellWidth; executed 98 times by 1 test: rowOffset += gridItem->item->width() - cellWidth;Executed by:
| 98 | ||||||||||||||||||||||||||||||
| 759 | else | - | ||||||||||||||||||||||||||||||
| 760 | colOffset += gridItem->item->width() - cellWidth; executed 94 times by 1 test: colOffset += gridItem->item->width() - cellWidth;Executed by:
| 94 | ||||||||||||||||||||||||||||||
| 761 | } | - | ||||||||||||||||||||||||||||||
| 762 | if (verticalLayoutDirection == QQuickItemView::BottomToTop
| 172-397 | ||||||||||||||||||||||||||||||
| 763 | if (flow == QQuickGridView::FlowTopToBottom
| 86 | ||||||||||||||||||||||||||||||
| 764 | colOffset += gridItem->item->height() - cellHeight; executed 86 times by 1 test: colOffset += gridItem->item->height() - cellHeight;Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 765 | else | - | ||||||||||||||||||||||||||||||
| 766 | rowOffset += gridItem->item->height() - cellHeight; executed 86 times by 1 test: rowOffset += gridItem->item->height() - cellHeight;Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 767 | } | - | ||||||||||||||||||||||||||||||
| 768 | if (visibleItems.count()
| 190-379 | ||||||||||||||||||||||||||||||
| 769 | qreal endPos = lastPosition(); | - | ||||||||||||||||||||||||||||||
| 770 | if (findLastVisibleIndex() == model->count()-1
| 58-321 | ||||||||||||||||||||||||||||||
| 771 | gridItem->setPosition(colOffset, endPos + rowOffset); | - | ||||||||||||||||||||||||||||||
| 772 | } executed 321 times by 1 test: else {end of blockExecuted by:
| 321 | ||||||||||||||||||||||||||||||
| 773 | qreal visiblePos = isContentFlowReversed()
| 0-58 | ||||||||||||||||||||||||||||||
| 774 | if (endPos <= visiblePos
| 0-58 | ||||||||||||||||||||||||||||||
| 775 | gridItem->setPosition(colOffset, endPos + rowOffset); executed 8 times by 1 test: gridItem->setPosition(colOffset, endPos + rowOffset);Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 776 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||||||||
| 777 | } else { | - | ||||||||||||||||||||||||||||||
| 778 | gridItem->setPosition(colOffset, rowOffset); | - | ||||||||||||||||||||||||||||||
| 779 | } executed 190 times by 1 test: end of blockExecuted by:
| 190 | ||||||||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||||||||
| 781 | if (created
| 86-483 | ||||||||||||||||||||||||||||||
| 782 | q->footerItemChanged(); executed 86 times by 1 test: q->footerItemChanged();Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 783 | } executed 569 times by 1 test: end of blockExecuted by:
| 569 | ||||||||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||||||||
| 785 | void QQuickGridViewPrivate::updateHeader() | - | ||||||||||||||||||||||||||||||
| 786 | { | - | ||||||||||||||||||||||||||||||
| 787 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 788 | bool created = false; | - | ||||||||||||||||||||||||||||||
| 789 | if (!header
| 524-10557 | ||||||||||||||||||||||||||||||
| 790 | QQuickItem *item = createComponentItem(headerComponent, 1.0); | - | ||||||||||||||||||||||||||||||
| 791 | if (!item
| 126-10431 | ||||||||||||||||||||||||||||||
| 792 | return; executed 10431 times by 4 tests: return;Executed by:
| 10431 | ||||||||||||||||||||||||||||||
| 793 | header = new FxGridItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 794 | header->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 795 | created = true; | - | ||||||||||||||||||||||||||||||
| 796 | } executed 126 times by 1 test: end of blockExecuted by:
| 126 | ||||||||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||||||||
| 798 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(header); | - | ||||||||||||||||||||||||||||||
| 799 | qreal colOffset = 0; | - | ||||||||||||||||||||||||||||||
| 800 | qreal rowOffset = -headerSize(); | - | ||||||||||||||||||||||||||||||
| 801 | if (q->effectiveLayoutDirection() == Qt::RightToLeft
| 169-481 | ||||||||||||||||||||||||||||||
| 802 | if (flow == QQuickGridView::FlowTopToBottom
| 82-87 | ||||||||||||||||||||||||||||||
| 803 | rowOffset += gridItem->item->width() - cellWidth; executed 82 times by 1 test: rowOffset += gridItem->item->width() - cellWidth;Executed by:
| 82 | ||||||||||||||||||||||||||||||
| 804 | else | - | ||||||||||||||||||||||||||||||
| 805 | colOffset += gridItem->item->width() - cellWidth; executed 87 times by 1 test: colOffset += gridItem->item->width() - cellWidth;Executed by:
| 87 | ||||||||||||||||||||||||||||||
| 806 | } | - | ||||||||||||||||||||||||||||||
| 807 | if (verticalLayoutDirection == QQuickItemView::BottomToTop
| 140-510 | ||||||||||||||||||||||||||||||
| 808 | if (flow == QQuickGridView::FlowTopToBottom
| 66-74 | ||||||||||||||||||||||||||||||
| 809 | colOffset += gridItem->item->height() - cellHeight; executed 74 times by 1 test: colOffset += gridItem->item->height() - cellHeight;Executed by:
| 74 | ||||||||||||||||||||||||||||||
| 810 | else | - | ||||||||||||||||||||||||||||||
| 811 | rowOffset += gridItem->item->height() - cellHeight; executed 66 times by 1 test: rowOffset += gridItem->item->height() - cellHeight;Executed by:
| 66 | ||||||||||||||||||||||||||||||
| 812 | } | - | ||||||||||||||||||||||||||||||
| 813 | if (visibleItems.count()
| 308-342 | ||||||||||||||||||||||||||||||
| 814 | qreal startPos = originPosition(); | - | ||||||||||||||||||||||||||||||
| 815 | if (visibleIndex == 0
| 47-295 | ||||||||||||||||||||||||||||||
| 816 | gridItem->setPosition(colOffset, startPos + rowOffset); | - | ||||||||||||||||||||||||||||||
| 817 | } executed 295 times by 1 test: else {end of blockExecuted by:
| 295 | ||||||||||||||||||||||||||||||
| 818 | qreal tempPos = isContentFlowReversed()
| 0-47 | ||||||||||||||||||||||||||||||
| 819 | qreal headerPos = isContentFlowReversed()
| 0-47 | ||||||||||||||||||||||||||||||
| 820 | if (tempPos <= startPos
| 0-47 | ||||||||||||||||||||||||||||||
| 821 | gridItem->setPosition(colOffset, startPos + rowOffset); executed 6 times by 1 test: gridItem->setPosition(colOffset, startPos + rowOffset);Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 822 | } executed 47 times by 1 test: end of blockExecuted by:
| 47 | ||||||||||||||||||||||||||||||
| 823 | } else { | - | ||||||||||||||||||||||||||||||
| 824 | if (isContentFlowReversed()
| 80-228 | ||||||||||||||||||||||||||||||
| 825 | gridItem->setPosition(colOffset, rowOffset); executed 80 times by 1 test: gridItem->setPosition(colOffset, rowOffset);Executed by:
| 80 | ||||||||||||||||||||||||||||||
| 826 | else | - | ||||||||||||||||||||||||||||||
| 827 | gridItem->setPosition(colOffset, -headerSize()); executed 228 times by 1 test: gridItem->setPosition(colOffset, -headerSize());Executed by:
| 228 | ||||||||||||||||||||||||||||||
| 828 | } | - | ||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||
| 830 | if (created
| 126-524 | ||||||||||||||||||||||||||||||
| 831 | q->headerItemChanged(); executed 126 times by 1 test: q->headerItemChanged();Executed by:
| 126 | ||||||||||||||||||||||||||||||
| 832 | } executed 650 times by 1 test: end of blockExecuted by:
| 650 | ||||||||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||||||||
| 834 | void QQuickGridViewPrivate::initializeCurrentItem() | - | ||||||||||||||||||||||||||||||
| 835 | { | - | ||||||||||||||||||||||||||||||
| 836 | if (currentItem
| 0-3088 | ||||||||||||||||||||||||||||||
| 837 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(currentItem); | - | ||||||||||||||||||||||||||||||
| 838 | FxViewItem *actualItem = visibleItem(currentIndex); | - | ||||||||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||
| 841 | if ((!actualItem
| 96-2957 | ||||||||||||||||||||||||||||||
| 842 | gridItem->setPosition(colPosAt(currentIndex), rowPosAt(currentIndex)); executed 2992 times by 4 tests: gridItem->setPosition(colPosAt(currentIndex), rowPosAt(currentIndex));Executed by:
| 2992 | ||||||||||||||||||||||||||||||
| 843 | } executed 3088 times by 4 tests: end of blockExecuted by:
| 3088 | ||||||||||||||||||||||||||||||
| 844 | } executed 3088 times by 4 tests: end of blockExecuted by:
| 3088 | ||||||||||||||||||||||||||||||
| 845 | - | |||||||||||||||||||||||||||||||
| 846 | void QQuickGridViewPrivate::fixupPosition() | - | ||||||||||||||||||||||||||||||
| 847 | { | - | ||||||||||||||||||||||||||||||
| 848 | if (flow == QQuickGridView::FlowLeftToRight
| 2114-3845 | ||||||||||||||||||||||||||||||
| 849 | fixupY(); executed 3845 times by 4 tests: fixupY();Executed by:
| 3845 | ||||||||||||||||||||||||||||||
| 850 | else | - | ||||||||||||||||||||||||||||||
| 851 | fixupX(); executed 2114 times by 1 test: fixupX();Executed by:
| 2114 | ||||||||||||||||||||||||||||||
| 852 | } | - | ||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||
| 854 | void QQuickGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) | - | ||||||||||||||||||||||||||||||
| 855 | { | - | ||||||||||||||||||||||||||||||
| 856 | if ((flow == QQuickGridView::FlowTopToBottom
| 222-6293 | ||||||||||||||||||||||||||||||
| 857 | || (flow == QQuickGridView::FlowLeftToRight
| 176-6293 | ||||||||||||||||||||||||||||||
| 858 | return; executed 398 times by 4 tests: return;Executed by:
| 398 | ||||||||||||||||||||||||||||||
| 859 | - | |||||||||||||||||||||||||||||||
| 860 | fixupMode = moveReason == Mouse
| 196-9243 | ||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||
| 862 | qreal viewPos = isContentFlowReversed()
| 3055-6384 | ||||||||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||||||||
| 864 | bool strictHighlightRange = haveHighlightRange
| 4-9138 | ||||||||||||||||||||||||||||||
| 865 | if (snapMode != QQuickGridView::NoSnap
| 348-9091 | ||||||||||||||||||||||||||||||
| 866 | qreal tempPosition = isContentFlowReversed()
| 171-177 | ||||||||||||||||||||||||||||||
| 867 | if (snapMode == QQuickGridView::SnapOneRow
| 88-176 | ||||||||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||||||||
| 869 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 870 | qreal bias = 0; | - | ||||||||||||||||||||||||||||||
| 871 | if (data.velocity > 0
| 0-46 | ||||||||||||||||||||||||||||||
| 872 | bias = rowSize()/2; executed 10 times by 1 test: bias = rowSize()/2;Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 873 | else if (data.velocity < 0
| 2-46 | ||||||||||||||||||||||||||||||
| 874 | bias = -rowSize()/2; executed 14 times by 1 test: bias = -rowSize()/2;Executed by:
| 14 | ||||||||||||||||||||||||||||||
| 875 | if (isContentFlowReversed()
| 22-66 | ||||||||||||||||||||||||||||||
| 876 | bias = -bias; executed 22 times by 1 test: bias = -bias;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 877 | tempPosition -= bias; | - | ||||||||||||||||||||||||||||||
| 878 | } executed 88 times by 1 test: end of blockExecuted by:
| 88 | ||||||||||||||||||||||||||||||
| 879 | FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart); | - | ||||||||||||||||||||||||||||||
| 880 | if (strictHighlightRange
| 0-237 | ||||||||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||||||||
| 882 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 883 | topItem = currentItem; | - | ||||||||||||||||||||||||||||||
| 884 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 885 | FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd); | - | ||||||||||||||||||||||||||||||
| 886 | if (strictHighlightRange
| 12-237 | ||||||||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||||||||
| 888 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 889 | bottomItem = currentItem; | - | ||||||||||||||||||||||||||||||
| 890 | } executed 81 times by 1 test: end of blockExecuted by:
| 81 | ||||||||||||||||||||||||||||||
| 891 | qreal pos; | - | ||||||||||||||||||||||||||||||
| 892 | bool isInBounds = -
| 25-263 | ||||||||||||||||||||||||||||||
| 893 | if (topItem
| 31-278 | ||||||||||||||||||||||||||||||
| 894 | qreal headerPos = header
| 0-247 | ||||||||||||||||||||||||||||||
| 895 | if (topItem->index == 0
| 0-152 | ||||||||||||||||||||||||||||||
| 896 | pos = isContentFlowReversed()
| 0 | ||||||||||||||||||||||||||||||
| 897 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 898 | if (isContentFlowReversed()
| 103-144 | ||||||||||||||||||||||||||||||
| 899 | pos = qMax(qMin(-topItem->position() + highlightRangeStart - size(), -maxExtent), -minExtent); executed 103 times by 1 test: pos = qMax(qMin(-topItem->position() + highlightRangeStart - size(), -maxExtent), -minExtent);Executed by:
| 103 | ||||||||||||||||||||||||||||||
| 900 | else | - | ||||||||||||||||||||||||||||||
| 901 | pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent); executed 144 times by 1 test: pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent);Executed by:
| 144 | ||||||||||||||||||||||||||||||
| 902 | } | - | ||||||||||||||||||||||||||||||
| 903 | } else if (bottomItem
| 0-76 | ||||||||||||||||||||||||||||||
| 904 | if (isContentFlowReversed()
| 0 | ||||||||||||||||||||||||||||||
| 905 | pos = qMax(qMin(-bottomItem->position() + highlightRangeEnd - size(), -maxExtent), -minExtent); never executed: pos = qMax(qMin(-bottomItem->position() + highlightRangeEnd - size(), -maxExtent), -minExtent); | 0 | ||||||||||||||||||||||||||||||
| 906 | else | - | ||||||||||||||||||||||||||||||
| 907 | pos = qMax(qMin(bottomItem->position() - highlightRangeEnd, -maxExtent), -minExtent); never executed: pos = qMax(qMin(bottomItem->position() - highlightRangeEnd, -maxExtent), -minExtent); | 0 | ||||||||||||||||||||||||||||||
| 908 | } else { | - | ||||||||||||||||||||||||||||||
| 909 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 910 | return; executed 101 times by 1 test: return;Executed by:
| 101 | ||||||||||||||||||||||||||||||
| 911 | } | - | ||||||||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||||||||
| 913 | qreal dist = qAbs(data.move + pos); | - | ||||||||||||||||||||||||||||||
| 914 | if (dist > 0
| 109-138 | ||||||||||||||||||||||||||||||
| 915 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 916 | if (fixupMode != Immediate
| 26-112 | ||||||||||||||||||||||||||||||
| 917 | timeline.move(data.move, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); | - | ||||||||||||||||||||||||||||||
| 918 | data.fixingUp = true; | - | ||||||||||||||||||||||||||||||
| 919 | } executed 112 times by 1 test: else {end of blockExecuted by:
| 112 | ||||||||||||||||||||||||||||||
| 920 | timeline.set(data.move, -pos); | - | ||||||||||||||||||||||||||||||
| 921 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||||||||
| 922 | vTime = timeline.time(); | - | ||||||||||||||||||||||||||||||
| 923 | } executed 138 times by 1 test: end of blockExecuted by:
| 138 | ||||||||||||||||||||||||||||||
| 924 | } executed 247 times by 1 test: else if (haveHighlightRangeend of blockExecuted by:
| 0-9031 | ||||||||||||||||||||||||||||||
| 925 | if (currentItem
| 16-44 | ||||||||||||||||||||||||||||||
| 926 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 927 | qreal pos = static_cast<FxGridItemSG*>(currentItem)->rowPos(); | - | ||||||||||||||||||||||||||||||
| 928 | if (viewPos < pos + rowSize() - highlightRangeEnd
| 12-32 | ||||||||||||||||||||||||||||||
| 929 | viewPos = pos + rowSize() - highlightRangeEnd; executed 32 times by 1 test: viewPos = pos + rowSize() - highlightRangeEnd;Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 930 | if (viewPos > pos - highlightRangeStart
| 0-44 | ||||||||||||||||||||||||||||||
| 931 | viewPos = pos - highlightRangeStart; executed 44 times by 1 test: viewPos = pos - highlightRangeStart;Executed by:
| 44 | ||||||||||||||||||||||||||||||
| 932 | if (isContentFlowReversed()
| 2-42 | ||||||||||||||||||||||||||||||
| 933 | viewPos = -viewPos-size(); executed 2 times by 1 test: viewPos = -viewPos-size();Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 934 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 935 | if (viewPos != position()
| 14-30 | ||||||||||||||||||||||||||||||
| 936 | if (fixupMode != Immediate
| 0-14 | ||||||||||||||||||||||||||||||
| 937 | timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); | - | ||||||||||||||||||||||||||||||
| 938 | data.fixingUp = true; | - | ||||||||||||||||||||||||||||||
| 939 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 940 | timeline.set(data.move, -viewPos); | - | ||||||||||||||||||||||||||||||
| 941 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||||||||
| 942 | } | - | ||||||||||||||||||||||||||||||
| 943 | vTime = timeline.time(); | - | ||||||||||||||||||||||||||||||
| 944 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||||||||||||||
| 945 | } executed 60 times by 1 test: else {end of blockExecuted by:
| 60 | ||||||||||||||||||||||||||||||
| 946 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 947 | } executed 9031 times by 4 tests: end of blockExecuted by:
| 9031 | ||||||||||||||||||||||||||||||
| 948 | data.inOvershoot = false; | - | ||||||||||||||||||||||||||||||
| 949 | fixupMode = Normal; | - | ||||||||||||||||||||||||||||||
| 950 | } executed 9338 times by 4 tests: end of blockExecuted by:
| 9338 | ||||||||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||||||||
| 952 | bool QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||||||||||||||||||||||||||
| 953 | QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) | - | ||||||||||||||||||||||||||||||
| 954 | { | - | ||||||||||||||||||||||||||||||
| 955 | data.fixingUp = false; | - | ||||||||||||||||||||||||||||||
| 956 | moveReason = Mouse; | - | ||||||||||||||||||||||||||||||
| 957 | if ((!haveHighlightRange
| 0-90 | ||||||||||||||||||||||||||||||
| 958 | && snapMode == QQuickGridView::NoSnap
| 12-78 | ||||||||||||||||||||||||||||||
| 959 | return executed 12 times by 1 test: QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);return QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);Executed by:
executed 12 times by 1 test: return QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 960 | } | - | ||||||||||||||||||||||||||||||
| 961 | qreal maxDistance = 0; | - | ||||||||||||||||||||||||||||||
| 962 | qreal dataValue = isContentFlowReversed()
| 56-112 | ||||||||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||||||||
| 964 | if (velocity > 0
| 82-86 | ||||||||||||||||||||||||||||||
| 965 | if (data.move.value() < minExtent
| 8-74 | ||||||||||||||||||||||||||||||
| 966 | if (snapMode == QQuickGridView::SnapOneRow
| 30-44 | ||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||
| 968 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 969 | qreal bias = dist < rowSize()/2
| 0-30 | ||||||||||||||||||||||||||||||
| 970 | if (isContentFlowReversed()
| 10-20 | ||||||||||||||||||||||||||||||
| 971 | bias = -bias; executed 10 times by 1 test: bias = -bias;Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 972 | data.flickTarget = -snapPosAt(-dataValue - bias); | - | ||||||||||||||||||||||||||||||
| 973 | maxDistance = qAbs(data.flickTarget - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 974 | velocity = maxVelocity; | - | ||||||||||||||||||||||||||||||
| 975 | } executed 30 times by 1 test: else {end of blockExecuted by:
| 30 | ||||||||||||||||||||||||||||||
| 976 | maxDistance = qAbs(minExtent - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 977 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||||||||||||||
| 978 | } | - | ||||||||||||||||||||||||||||||
| 979 | if (snapMode == QQuickGridView::NoSnap
| 0-82 | ||||||||||||||||||||||||||||||
| 980 | data.flickTarget = minExtent; never executed: data.flickTarget = minExtent; | 0 | ||||||||||||||||||||||||||||||
| 981 | } executed 82 times by 1 test: else {end of blockExecuted by:
| 82 | ||||||||||||||||||||||||||||||
| 982 | if (data.move.value() > maxExtent
| 10-76 | ||||||||||||||||||||||||||||||
| 983 | if (snapMode == QQuickGridView::SnapOneRow
| 30-46 | ||||||||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||||||||
| 985 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 986 | qreal bias = -
| 0-30 | ||||||||||||||||||||||||||||||
| 987 | if (isContentFlowReversed()
| 10-20 | ||||||||||||||||||||||||||||||
| 988 | bias = -bias; executed 10 times by 1 test: bias = -bias;Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 989 | data.flickTarget = -snapPosAt(-dataValue + bias); | - | ||||||||||||||||||||||||||||||
| 990 | maxDistance = qAbs(data.flickTarget - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 991 | velocity = -maxVelocity; | - | ||||||||||||||||||||||||||||||
| 992 | } executed 30 times by 1 test: else {end of blockExecuted by:
| 30 | ||||||||||||||||||||||||||||||
| 993 | maxDistance = qAbs(maxExtent - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 994 | } executed 46 times by 1 test: end of blockExecuted by:
| 46 | ||||||||||||||||||||||||||||||
| 995 | } | - | ||||||||||||||||||||||||||||||
| 996 | if (snapMode == QQuickGridView::NoSnap
| 0-86 | ||||||||||||||||||||||||||||||
| 997 | data.flickTarget = maxExtent; never executed: data.flickTarget = maxExtent; | 0 | ||||||||||||||||||||||||||||||
| 998 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||||||||
| 999 | bool overShoot = boundsBehavior & QQuickFlickable::OvershootBounds; | - | ||||||||||||||||||||||||||||||
| 1000 | if (maxDistance > 0
| 0-150 | ||||||||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||||||||
| 1002 | qreal v = velocity; | - | ||||||||||||||||||||||||||||||
| 1003 | if (maxVelocity != -1
| 0-168 | ||||||||||||||||||||||||||||||
| 1004 | if (v < 0
| 0 | ||||||||||||||||||||||||||||||
| 1005 | v = -maxVelocity; never executed: v = -maxVelocity; | 0 | ||||||||||||||||||||||||||||||
| 1006 | else | - | ||||||||||||||||||||||||||||||
| 1007 | v = maxVelocity; never executed: v = maxVelocity; | 0 | ||||||||||||||||||||||||||||||
| 1008 | } | - | ||||||||||||||||||||||||||||||
| 1009 | qreal accel = deceleration; | - | ||||||||||||||||||||||||||||||
| 1010 | qreal v2 = v * v; | - | ||||||||||||||||||||||||||||||
| 1011 | qreal overshootDist = 0.0; | - | ||||||||||||||||||||||||||||||
| 1012 | if ((maxDistance > 0.0
| 18-150 | ||||||||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||||||||
| 1014 | qreal dist = v2 / (accel * 2.0) + rowSize()/4; | - | ||||||||||||||||||||||||||||||
| 1015 | dist = qMin(dist, maxDistance); | - | ||||||||||||||||||||||||||||||
| 1016 | if (v > 0
| 70-74 | ||||||||||||||||||||||||||||||
| 1017 | dist = -dist; executed 70 times by 1 test: dist = -dist;Executed by:
| 70 | ||||||||||||||||||||||||||||||
| 1018 | if (snapMode != QQuickGridView::SnapOneRow
| 66-78 | ||||||||||||||||||||||||||||||
| 1019 | qreal distTemp = isContentFlowReversed()
| 26-52 | ||||||||||||||||||||||||||||||
| 1020 | data.flickTarget = -snapPosAt(-dataValue + distTemp); | - | ||||||||||||||||||||||||||||||
| 1021 | } executed 78 times by 1 test: end of blockExecuted by:
| 78 | ||||||||||||||||||||||||||||||
| 1022 | data.flickTarget = isContentFlowReversed()
| 48-96 | ||||||||||||||||||||||||||||||
| 1023 | if (overShoot
| 0-144 | ||||||||||||||||||||||||||||||
| 1024 | if (data.flickTarget >= minExtent
| 10-134 | ||||||||||||||||||||||||||||||
| 1025 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1026 | data.flickTarget += overshootDist; | - | ||||||||||||||||||||||||||||||
| 1027 | } executed 10 times by 1 test: else if (data.flickTarget <= maxExtentend of blockExecuted by:
| 10-124 | ||||||||||||||||||||||||||||||
| 1028 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1029 | data.flickTarget -= overshootDist; | - | ||||||||||||||||||||||||||||||
| 1030 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 1031 | } executed 144 times by 1 test: end of blockExecuted by:
| 144 | ||||||||||||||||||||||||||||||
| 1032 | qreal adjDist = -data.flickTarget + data.move.value(); | - | ||||||||||||||||||||||||||||||
| 1033 | if (qAbs(adjDist) > qAbs(dist)
| 22-122 | ||||||||||||||||||||||||||||||
| 1034 | - | |||||||||||||||||||||||||||||||
| 1035 | qreal adjv2 = accel * 2.0f * qAbs(adjDist); | - | ||||||||||||||||||||||||||||||
| 1036 | if (adjv2 > v2
| 10-12 | ||||||||||||||||||||||||||||||
| 1037 | v2 = adjv2; | - | ||||||||||||||||||||||||||||||
| 1038 | v = qSqrt(v2); | - | ||||||||||||||||||||||||||||||
| 1039 | if (dist > 0
| 4-6 | ||||||||||||||||||||||||||||||
| 1040 | v = -v; executed 4 times by 1 test: v = -v;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1041 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 1042 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 1043 | dist = adjDist; | - | ||||||||||||||||||||||||||||||
| 1044 | accel = v2 / (2.0f * qAbs(dist)); | - | ||||||||||||||||||||||||||||||
| 1045 | } executed 144 times by 1 test: else {end of blockExecuted by:
| 144 | ||||||||||||||||||||||||||||||
| 1046 | data.flickTarget = velocity > 0
| 12 | ||||||||||||||||||||||||||||||
| 1047 | overshootDist = overShoot
| 0-24 | ||||||||||||||||||||||||||||||
| 1048 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||||||||
| 1049 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1050 | timeline.accel(data.move, v, accel, maxDistance + overshootDist); | - | ||||||||||||||||||||||||||||||
| 1051 | timeline.callback(QQuickTimeLineCallback(&data.move, fixupCallback, this)); | - | ||||||||||||||||||||||||||||||
| 1052 | return executed 168 times by 1 test: true;return true;Executed by:
executed 168 times by 1 test: return true;Executed by:
| 168 | ||||||||||||||||||||||||||||||
| 1053 | } else { | - | ||||||||||||||||||||||||||||||
| 1054 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1055 | fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 1056 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1057 | } | - | ||||||||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||||||||
| 1059 | QQuickGridView::QQuickGridView(QQuickItem *parent) | - | ||||||||||||||||||||||||||||||
| 1060 | : QQuickItemView(*(new QQuickGridViewPrivate), parent) | - | ||||||||||||||||||||||||||||||
| 1061 | { | - | ||||||||||||||||||||||||||||||
| 1062 | } executed 1782 times by 4 tests: end of blockExecuted by:
| 1782 | ||||||||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||||||||
| 1064 | QQuickGridView::~QQuickGridView() | - | ||||||||||||||||||||||||||||||
| 1065 | { | - | ||||||||||||||||||||||||||||||
| 1066 | } | - | ||||||||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||||||||
| 1068 | void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) | - | ||||||||||||||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||||||||||||||
| 1070 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1071 | if (d->autoHighlight != autoHighlight
| 0-8 | ||||||||||||||||||||||||||||||
| 1072 | if (!autoHighlight
| 0-8 | ||||||||||||||||||||||||||||||
| 1073 | d->highlightXAnimator->stop(); | - | ||||||||||||||||||||||||||||||
| 1074 | d->highlightYAnimator->stop(); | - | ||||||||||||||||||||||||||||||
| 1075 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1076 | QQuickItemView::setHighlightFollowsCurrentItem(autoHighlight); | - | ||||||||||||||||||||||||||||||
| 1077 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 1078 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 1079 | void QQuickGridView::setHighlightMoveDuration(int duration) | - | ||||||||||||||||||||||||||||||
| 1080 | { | - | ||||||||||||||||||||||||||||||
| 1081 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1082 | if (d->highlightMoveDuration != duration
| 0-6 | ||||||||||||||||||||||||||||||
| 1083 | if (d->highlightYAnimator
| 2-4 | ||||||||||||||||||||||||||||||
| 1084 | d->highlightXAnimator->userDuration = duration; | - | ||||||||||||||||||||||||||||||
| 1085 | d->highlightYAnimator->userDuration = duration; | - | ||||||||||||||||||||||||||||||
| 1086 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1087 | QQuickItemView::setHighlightMoveDuration(duration); | - | ||||||||||||||||||||||||||||||
| 1088 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 1089 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 1090 | QQuickGridView::Flow QQuickGridView::flow() const | - | ||||||||||||||||||||||||||||||
| 1091 | { | - | ||||||||||||||||||||||||||||||
| 1092 | const QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1093 | return executed 1044191 times by 4 tests: d->flow;return d->flow;Executed by:
executed 1044191 times by 4 tests: return d->flow;Executed by:
| 1044191 | ||||||||||||||||||||||||||||||
| 1094 | } | - | ||||||||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||||||||
| 1096 | void QQuickGridView::setFlow(Flow flow) | - | ||||||||||||||||||||||||||||||
| 1097 | { | - | ||||||||||||||||||||||||||||||
| 1098 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1099 | if (d->flow != flow
| 638-666 | ||||||||||||||||||||||||||||||
| 1100 | d->flow = flow; | - | ||||||||||||||||||||||||||||||
| 1101 | if (d->flow == FlowLeftToRight
| 16-650 | ||||||||||||||||||||||||||||||
| 1102 | setContentWidth(-1); | - | ||||||||||||||||||||||||||||||
| 1103 | setFlickableDirection(VerticalFlick); | - | ||||||||||||||||||||||||||||||
| 1104 | } executed 16 times by 1 test: else {end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 1105 | setContentHeight(-1); | - | ||||||||||||||||||||||||||||||
| 1106 | setFlickableDirection(HorizontalFlick); | - | ||||||||||||||||||||||||||||||
| 1107 | } executed 650 times by 1 test: end of blockExecuted by:
| 650 | ||||||||||||||||||||||||||||||
| 1108 | setContentX(0); | - | ||||||||||||||||||||||||||||||
| 1109 | setContentY(0); | - | ||||||||||||||||||||||||||||||
| 1110 | d->regenerate(true); | - | ||||||||||||||||||||||||||||||
| 1111 | flowChanged(); | - | ||||||||||||||||||||||||||||||
| 1112 | } executed 666 times by 1 test: end of blockExecuted by:
| 666 | ||||||||||||||||||||||||||||||
| 1113 | } executed 1304 times by 1 test: end of blockExecuted by:
| 1304 | ||||||||||||||||||||||||||||||
| 1114 | qreal QQuickGridView::cellWidth() const | - | ||||||||||||||||||||||||||||||
| 1115 | { | - | ||||||||||||||||||||||||||||||
| 1116 | const QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1117 | return executed 313945 times by 2 tests: d->cellWidth;return d->cellWidth;Executed by:
executed 313945 times by 2 tests: return d->cellWidth;Executed by:
| 313945 | ||||||||||||||||||||||||||||||
| 1118 | } | - | ||||||||||||||||||||||||||||||
| 1119 | - | |||||||||||||||||||||||||||||||
| 1120 | void QQuickGridView::setCellWidth(qreal cellWidth) | - | ||||||||||||||||||||||||||||||
| 1121 | { | - | ||||||||||||||||||||||||||||||
| 1122 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1123 | if (cellWidth != d->cellWidth
| 0-1740 | ||||||||||||||||||||||||||||||
| 1124 | d->cellWidth = qMax(qreal(1), cellWidth); | - | ||||||||||||||||||||||||||||||
| 1125 | d->updateViewport(); | - | ||||||||||||||||||||||||||||||
| 1126 | cellWidthChanged(); | - | ||||||||||||||||||||||||||||||
| 1127 | d->forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 1128 | } executed 1740 times by 2 tests: end of blockExecuted by:
| 1740 | ||||||||||||||||||||||||||||||
| 1129 | } executed 1750 times by 2 tests: end of blockExecuted by:
| 1750 | ||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||
| 1131 | qreal QQuickGridView::cellHeight() const | - | ||||||||||||||||||||||||||||||
| 1132 | { | - | ||||||||||||||||||||||||||||||
| 1133 | const QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1134 | return executed 182823 times by 3 tests: d->cellHeight;return d->cellHeight;Executed by:
executed 182823 times by 3 tests: return d->cellHeight;Executed by:
| 182823 | ||||||||||||||||||||||||||||||
| 1135 | } | - | ||||||||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||||||||
| 1137 | void QQuickGridView::setCellHeight(qreal cellHeight) | - | ||||||||||||||||||||||||||||||
| 1138 | { | - | ||||||||||||||||||||||||||||||
| 1139 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1140 | if (cellHeight != d->cellHeight
| 0-1686 | ||||||||||||||||||||||||||||||
| 1141 | d->cellHeight = qMax(qreal(1), cellHeight); | - | ||||||||||||||||||||||||||||||
| 1142 | d->updateViewport(); | - | ||||||||||||||||||||||||||||||
| 1143 | cellHeightChanged(); | - | ||||||||||||||||||||||||||||||
| 1144 | d->forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 1145 | } executed 1686 times by 2 tests: end of blockExecuted by:
| 1686 | ||||||||||||||||||||||||||||||
| 1146 | } executed 1742 times by 2 tests: end of blockExecuted by:
| 1742 | ||||||||||||||||||||||||||||||
| 1147 | QQuickGridView::SnapMode QQuickGridView::snapMode() const | - | ||||||||||||||||||||||||||||||
| 1148 | { | - | ||||||||||||||||||||||||||||||
| 1149 | const QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1150 | return executed 2 times by 1 test: d->snapMode;return d->snapMode;Executed by:
executed 2 times by 1 test: return d->snapMode;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1151 | } | - | ||||||||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||||||||
| 1153 | void QQuickGridView::setSnapMode(SnapMode mode) | - | ||||||||||||||||||||||||||||||
| 1154 | { | - | ||||||||||||||||||||||||||||||
| 1155 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1156 | if (d->snapMode != mode
| 0-32 | ||||||||||||||||||||||||||||||
| 1157 | d->snapMode = mode; | - | ||||||||||||||||||||||||||||||
| 1158 | snapModeChanged(); | - | ||||||||||||||||||||||||||||||
| 1159 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||||||||
| 1160 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||||||||
| 1161 | void QQuickGridView::viewportMoved(Qt::Orientations orient) | - | ||||||||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||||||||
| 1163 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1164 | QQuickItemView::viewportMoved(orient); | - | ||||||||||||||||||||||||||||||
| 1165 | if (!d->itemCount
| 1054-6739 | ||||||||||||||||||||||||||||||
| 1166 | return; executed 1054 times by 1 test: return;Executed by:
| 1054 | ||||||||||||||||||||||||||||||
| 1167 | if (d->inViewportMoved
| 19-6720 | ||||||||||||||||||||||||||||||
| 1168 | return; executed 19 times by 1 test: return;Executed by:
| 19 | ||||||||||||||||||||||||||||||
| 1169 | d->inViewportMoved = true; | - | ||||||||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||||||||
| 1171 | if (yflick()
| 3105-3615 | ||||||||||||||||||||||||||||||
| 1172 | if (d->isContentFlowReversed()
| 190-2915 | ||||||||||||||||||||||||||||||
| 1173 | d->bufferMode = d->vData.smoothVelocity < 0
executed 190 times by 1 test: d->bufferMode = d->vData.smoothVelocity < 0 ? QQuickItemViewPrivate::BufferAfter : QQuickItemViewPrivate::BufferBefore;Executed by:
| 0-190 | ||||||||||||||||||||||||||||||
| 1174 | else | - | ||||||||||||||||||||||||||||||
| 1175 | d->bufferMode = d->vData.smoothVelocity < 0
executed 2915 times by 1 test: d->bufferMode = d->vData.smoothVelocity < 0 ? QQuickItemViewPrivate::BufferBefore : QQuickItemViewPrivate::BufferAfter;Executed by:
| 1222-2915 | ||||||||||||||||||||||||||||||
| 1176 | } else { | - | ||||||||||||||||||||||||||||||
| 1177 | if (d->isContentFlowReversed()
| 1771-1844 | ||||||||||||||||||||||||||||||
| 1178 | d->bufferMode = d->hData.smoothVelocity < 0
executed 1844 times by 1 test: d->bufferMode = d->hData.smoothVelocity < 0 ? QQuickItemViewPrivate::BufferAfter : QQuickItemViewPrivate::BufferBefore;Executed by:
| 737-1844 | ||||||||||||||||||||||||||||||
| 1179 | else | - | ||||||||||||||||||||||||||||||
| 1180 | d->bufferMode = d->hData.smoothVelocity < 0
executed 1771 times by 1 test: d->bufferMode = d->hData.smoothVelocity < 0 ? QQuickItemViewPrivate::BufferBefore : QQuickItemViewPrivate::BufferAfter;Executed by:
| 766-1771 | ||||||||||||||||||||||||||||||
| 1181 | } | - | ||||||||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||||||||
| 1183 | d->refillOrLayout(); | - | ||||||||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||||||||
| 1185 | - | |||||||||||||||||||||||||||||||
| 1186 | qreal from = d->isContentFlowReversed()
| 2034-4686 | ||||||||||||||||||||||||||||||
| 1187 | qreal to = d->isContentFlowReversed()
| 2034-4686 | ||||||||||||||||||||||||||||||
| 1188 | for (FxViewItem *item : qAsConst(d->visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 1189 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(item); | - | ||||||||||||||||||||||||||||||
| 1190 | QQuickItemPrivate::get(gridItem->item)->setCulled(gridItem->rowPos() + d->rowSize() < from || gridItem->rowPos() > to); | - | ||||||||||||||||||||||||||||||
| 1191 | } executed 142751 times by 1 test: end of blockExecuted by:
| 142751 | ||||||||||||||||||||||||||||||
| 1192 | if (d->currentItem
| 0-6720 | ||||||||||||||||||||||||||||||
| 1193 | FxGridItemSG *item = static_cast<FxGridItemSG*>(d->currentItem); | - | ||||||||||||||||||||||||||||||
| 1194 | QQuickItemPrivate::get(item->item)->setCulled(item->rowPos() + d->rowSize() < from || item->rowPos() > to); | - | ||||||||||||||||||||||||||||||
| 1195 | } executed 6720 times by 1 test: end of blockExecuted by:
| 6720 | ||||||||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||||||||
| 1197 | if (d->hData.flicking
| 440-4162 | ||||||||||||||||||||||||||||||
| 1198 | d->moveReason = QQuickGridViewPrivate::Mouse; executed 5080 times by 1 test: d->moveReason = QQuickGridViewPrivate::Mouse;Executed by:
| 5080 | ||||||||||||||||||||||||||||||
| 1199 | if (d->moveReason != QQuickGridViewPrivate::SetIndex
| 477-6243 | ||||||||||||||||||||||||||||||
| 1200 | if (d->haveHighlightRange
| 0-3771 | ||||||||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||||||||
| 1202 | qreal pos = d->highlight->position(); | - | ||||||||||||||||||||||||||||||
| 1203 | qreal viewPos = d->isContentFlowReversed()
| 736-1736 | ||||||||||||||||||||||||||||||
| 1204 | if (pos > viewPos + d->highlightRangeEnd - d->highlight->size()
| 1195-1277 | ||||||||||||||||||||||||||||||
| 1205 | pos = viewPos + d->highlightRangeEnd - d->highlight->size(); executed 1277 times by 1 test: pos = viewPos + d->highlightRangeEnd - d->highlight->size();Executed by:
| 1277 | ||||||||||||||||||||||||||||||
| 1206 | if (pos < viewPos + d->highlightRangeStart
| 1177-1295 | ||||||||||||||||||||||||||||||
| 1207 | pos = viewPos + d->highlightRangeStart; executed 1295 times by 1 test: pos = viewPos + d->highlightRangeStart;Executed by:
| 1295 | ||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||
| 1209 | if (pos != d->highlight->position()
| 26-2446 | ||||||||||||||||||||||||||||||
| 1210 | d->highlightXAnimator->stop(); | - | ||||||||||||||||||||||||||||||
| 1211 | d->highlightYAnimator->stop(); | - | ||||||||||||||||||||||||||||||
| 1212 | static_cast<FxGridItemSG*>(d->highlight)->setPosition(static_cast<FxGridItemSG*>(d->highlight)->colPos(), pos); | - | ||||||||||||||||||||||||||||||
| 1213 | } executed 2446 times by 1 test: else {end of blockExecuted by:
| 2446 | ||||||||||||||||||||||||||||||
| 1214 | d->updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 1215 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||||||||
| 1217 | - | |||||||||||||||||||||||||||||||
| 1218 | int idx = d->snapIndex(); | - | ||||||||||||||||||||||||||||||
| 1219 | if (idx >= 0
| 0-2472 | ||||||||||||||||||||||||||||||
| 1220 | d->updateCurrent(idx); | - | ||||||||||||||||||||||||||||||
| 1221 | if (d->currentItem
| 0-222 | ||||||||||||||||||||||||||||||
| 1222 | if (d->flow == FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1223 | d->highlightXAnimator->to = d->currentItem->itemX(); never executed: d->highlightXAnimator->to = d->currentItem->itemX(); | 0 | ||||||||||||||||||||||||||||||
| 1224 | else | - | ||||||||||||||||||||||||||||||
| 1225 | d->highlightYAnimator->to = d->currentItem->itemY(); never executed: d->highlightYAnimator->to = d->currentItem->itemY(); | 0 | ||||||||||||||||||||||||||||||
| 1226 | } | - | ||||||||||||||||||||||||||||||
| 1227 | } executed 222 times by 1 test: end of blockExecuted by:
| 222 | ||||||||||||||||||||||||||||||
| 1228 | } executed 2472 times by 1 test: end of blockExecuted by:
| 2472 | ||||||||||||||||||||||||||||||
| 1229 | } executed 6243 times by 1 test: end of blockExecuted by:
| 6243 | ||||||||||||||||||||||||||||||
| 1230 | - | |||||||||||||||||||||||||||||||
| 1231 | d->inViewportMoved = false; | - | ||||||||||||||||||||||||||||||
| 1232 | } executed 6720 times by 1 test: end of blockExecuted by:
| 6720 | ||||||||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||||||||
| 1234 | void QQuickGridView::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||||||||
| 1235 | { | - | ||||||||||||||||||||||||||||||
| 1236 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1237 | if (d->model && d->model->count()
| 0-6 | ||||||||||||||||||||||||||||||
| 1238 | || (d->explicitKeyNavigationEnabled
| 2-4 | ||||||||||||||||||||||||||||||
| 1239 | d->moveReason = QQuickGridViewPrivate::SetIndex; | - | ||||||||||||||||||||||||||||||
| 1240 | int oldCurrent = currentIndex(); | - | ||||||||||||||||||||||||||||||
| 1241 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||
| 1242 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||||||||
| 1243 | moveCurrentIndexUp(); | - | ||||||||||||||||||||||||||||||
| 1244 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1245 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||||||||
| 1246 | moveCurrentIndexDown(); | - | ||||||||||||||||||||||||||||||
| 1247 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1248 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||||||||
| 1249 | moveCurrentIndexLeft(); | - | ||||||||||||||||||||||||||||||
| 1250 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1251 | case executed 2 times by 1 test: Qt::Key_Right:case Qt::Key_Right:Executed by:
executed 2 times by 1 test: case Qt::Key_Right:Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1252 | moveCurrentIndexRight(); | - | ||||||||||||||||||||||||||||||
| 1253 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1254 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1255 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1256 | } | - | ||||||||||||||||||||||||||||||
| 1257 | if (oldCurrent != currentIndex()
| 0-2 | ||||||||||||||||||||||||||||||
| 1258 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 1259 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1260 | } | - | ||||||||||||||||||||||||||||||
| 1261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1262 | event->ignore(); | - | ||||||||||||||||||||||||||||||
| 1263 | QQuickItemView::keyPressEvent(event); | - | ||||||||||||||||||||||||||||||
| 1264 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||||||||
| 1266 | void QQuickGridView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | - | ||||||||||||||||||||||||||||||
| 1267 | { | - | ||||||||||||||||||||||||||||||
| 1268 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1269 | d->resetColumns(); | - | ||||||||||||||||||||||||||||||
| 1270 | - | |||||||||||||||||||||||||||||||
| 1271 | if (newGeometry.width() != oldGeometry.width()
| 1802-1942 | ||||||||||||||||||||||||||||||
| 1272 | && newGeometry.height() != oldGeometry.height()
| 88-1714 | ||||||||||||||||||||||||||||||
| 1273 | d->setPosition(d->position()); | - | ||||||||||||||||||||||||||||||
| 1274 | } executed 88 times by 4 tests: else if (newGeometry.width() != oldGeometry.width()end of blockExecuted by:
| 88-1942 | ||||||||||||||||||||||||||||||
| 1275 | QQuickFlickable::setContentX(d->contentXForPosition(d->position())); | - | ||||||||||||||||||||||||||||||
| 1276 | } executed 1714 times by 2 tests: else if (newGeometry.height() != oldGeometry.height()end of blockExecuted by:
| 222-1720 | ||||||||||||||||||||||||||||||
| 1277 | QQuickFlickable::setContentY(d->contentYForPosition(d->position())); | - | ||||||||||||||||||||||||||||||
| 1278 | } executed 1720 times by 2 tests: end of blockExecuted by:
| 1720 | ||||||||||||||||||||||||||||||
| 1279 | - | |||||||||||||||||||||||||||||||
| 1280 | QQuickItemView::geometryChanged(newGeometry, oldGeometry); | - | ||||||||||||||||||||||||||||||
| 1281 | } executed 3744 times by 4 tests: end of blockExecuted by:
| 3744 | ||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||
| 1283 | void QQuickGridView::initItem(int index, QObject *obj) | - | ||||||||||||||||||||||||||||||
| 1284 | { | - | ||||||||||||||||||||||||||||||
| 1285 | QQuickItemView::initItem(index, obj); | - | ||||||||||||||||||||||||||||||
| 1286 | - | |||||||||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||||||||
| 1288 | - | |||||||||||||||||||||||||||||||
| 1289 | QQuickItem *item = qmlobject_cast<QQuickItem*>(obj); | - | ||||||||||||||||||||||||||||||
| 1290 | if (item
| 0-46119 | ||||||||||||||||||||||||||||||
| 1291 | QQuickGridViewAttached *attached = static_cast<QQuickGridViewAttached *>( | - | ||||||||||||||||||||||||||||||
| 1292 | qmlAttachedPropertiesObject<QQuickGridView>(item)); | - | ||||||||||||||||||||||||||||||
| 1293 | if (attached
| 0-46119 | ||||||||||||||||||||||||||||||
| 1294 | attached->setView(this); executed 46119 times by 4 tests: attached->setView(this);Executed by:
| 46119 | ||||||||||||||||||||||||||||||
| 1295 | } executed 46119 times by 4 tests: end of blockExecuted by:
| 46119 | ||||||||||||||||||||||||||||||
| 1296 | } executed 46119 times by 4 tests: end of blockExecuted by:
| 46119 | ||||||||||||||||||||||||||||||
| 1297 | void QQuickGridView::moveCurrentIndexUp() | - | ||||||||||||||||||||||||||||||
| 1298 | { | - | ||||||||||||||||||||||||||||||
| 1299 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1300 | const int count = d->model
| 0 | ||||||||||||||||||||||||||||||
| 1301 | if (!count
| 0 | ||||||||||||||||||||||||||||||
| 1302 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1303 | if (d->verticalLayoutDirection == QQuickItemView::TopToBottom
| 0 | ||||||||||||||||||||||||||||||
| 1304 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1305 | if (currentIndex() >= d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1306 | int index = currentIndex() - d->columns; | - | ||||||||||||||||||||||||||||||
| 1307 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1308 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1309 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1310 | if (currentIndex() > 0
| 0 | ||||||||||||||||||||||||||||||
| 1311 | int index = currentIndex() - 1; | - | ||||||||||||||||||||||||||||||
| 1312 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1314 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1315 | } else { | - | ||||||||||||||||||||||||||||||
| 1316 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1317 | if (currentIndex() < count - d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1318 | int index = currentIndex()+d->columns; | - | ||||||||||||||||||||||||||||||
| 1319 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1320 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1321 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1322 | if (currentIndex() < count - 1
| 0 | ||||||||||||||||||||||||||||||
| 1323 | int index = currentIndex() + 1; | - | ||||||||||||||||||||||||||||||
| 1324 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1325 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1326 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1327 | } | - | ||||||||||||||||||||||||||||||
| 1328 | } | - | ||||||||||||||||||||||||||||||
| 1329 | void QQuickGridView::moveCurrentIndexDown() | - | ||||||||||||||||||||||||||||||
| 1330 | { | - | ||||||||||||||||||||||||||||||
| 1331 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1332 | const int count = d->model
| 0-2 | ||||||||||||||||||||||||||||||
| 1333 | if (!count
| 0-2 | ||||||||||||||||||||||||||||||
| 1334 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||||||||
| 1336 | if (d->verticalLayoutDirection == QQuickItemView::TopToBottom
| 0-2 | ||||||||||||||||||||||||||||||
| 1337 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0-2 | ||||||||||||||||||||||||||||||
| 1338 | if (currentIndex() < count - d->columns
| 0-2 | ||||||||||||||||||||||||||||||
| 1339 | int index = currentIndex()+d->columns; | - | ||||||||||||||||||||||||||||||
| 1340 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1341 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1342 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1343 | if (currentIndex() < count - 1
| 0 | ||||||||||||||||||||||||||||||
| 1344 | int index = currentIndex() + 1; | - | ||||||||||||||||||||||||||||||
| 1345 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1346 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1347 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1348 | } else { | - | ||||||||||||||||||||||||||||||
| 1349 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1350 | if (currentIndex() >= d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1351 | int index = currentIndex() - d->columns; | - | ||||||||||||||||||||||||||||||
| 1352 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1353 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1354 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1355 | if (currentIndex() > 0
| 0 | ||||||||||||||||||||||||||||||
| 1356 | int index = currentIndex() - 1; | - | ||||||||||||||||||||||||||||||
| 1357 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1358 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1360 | } | - | ||||||||||||||||||||||||||||||
| 1361 | } | - | ||||||||||||||||||||||||||||||
| 1362 | void QQuickGridView::moveCurrentIndexLeft() | - | ||||||||||||||||||||||||||||||
| 1363 | { | - | ||||||||||||||||||||||||||||||
| 1364 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1365 | const int count = d->model
| 0 | ||||||||||||||||||||||||||||||
| 1366 | if (!count
| 0 | ||||||||||||||||||||||||||||||
| 1367 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1368 | if (effectiveLayoutDirection() == Qt::LeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1369 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1370 | if (currentIndex() > 0
| 0 | ||||||||||||||||||||||||||||||
| 1371 | int index = currentIndex() - 1; | - | ||||||||||||||||||||||||||||||
| 1372 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1374 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1375 | if (currentIndex() >= d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1376 | int index = currentIndex() - d->columns; | - | ||||||||||||||||||||||||||||||
| 1377 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1378 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1380 | } else { | - | ||||||||||||||||||||||||||||||
| 1381 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1382 | if (currentIndex() < count - 1
| 0 | ||||||||||||||||||||||||||||||
| 1383 | int index = currentIndex() + 1; | - | ||||||||||||||||||||||||||||||
| 1384 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1385 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1386 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1387 | if (currentIndex() < count - d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1388 | int index = currentIndex() + d->columns; | - | ||||||||||||||||||||||||||||||
| 1389 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1391 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1392 | } | - | ||||||||||||||||||||||||||||||
| 1393 | } | - | ||||||||||||||||||||||||||||||
| 1394 | void QQuickGridView::moveCurrentIndexRight() | - | ||||||||||||||||||||||||||||||
| 1395 | { | - | ||||||||||||||||||||||||||||||
| 1396 | QQuickGridViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1397 | const int count = d->model
| 0-2 | ||||||||||||||||||||||||||||||
| 1398 | if (!count
| 0-2 | ||||||||||||||||||||||||||||||
| 1399 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1400 | if (effectiveLayoutDirection() == Qt::LeftToRight
| 0-2 | ||||||||||||||||||||||||||||||
| 1401 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0-2 | ||||||||||||||||||||||||||||||
| 1402 | if (currentIndex() < count - 1
| 0-2 | ||||||||||||||||||||||||||||||
| 1403 | int index = currentIndex() + 1; | - | ||||||||||||||||||||||||||||||
| 1404 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1405 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1406 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1407 | if (currentIndex() < count - d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1408 | int index = currentIndex()+d->columns; | - | ||||||||||||||||||||||||||||||
| 1409 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 1410 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1411 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1412 | } else { | - | ||||||||||||||||||||||||||||||
| 1413 | if (d->flow == QQuickGridView::FlowLeftToRight
| 0 | ||||||||||||||||||||||||||||||
| 1414 | if (currentIndex() > 0
| 0 | ||||||||||||||||||||||||||||||
| 1415 | int index = currentIndex() - 1; | - | ||||||||||||||||||||||||||||||
| 1416 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1417 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1418 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1419 | if (currentIndex() >= d->columns
| 0 | ||||||||||||||||||||||||||||||
| 1420 | int index = currentIndex() - d->columns; | - | ||||||||||||||||||||||||||||||
| 1421 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 1422 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1423 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1424 | } | - | ||||||||||||||||||||||||||||||
| 1425 | } | - | ||||||||||||||||||||||||||||||
| 1426 | - | |||||||||||||||||||||||||||||||
| 1427 | bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &change, ChangeResult *insertResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) | - | ||||||||||||||||||||||||||||||
| 1428 | { | - | ||||||||||||||||||||||||||||||
| 1429 | QQuickGridView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1430 | - | |||||||||||||||||||||||||||||||
| 1431 | int modelIndex = change.index; | - | ||||||||||||||||||||||||||||||
| 1432 | int count = change.count; | - | ||||||||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||||||||
| 1434 | int index = visibleItems.count()
| 102-1158 | ||||||||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||||||||
| 1436 | if (index < 0
| 228-1032 | ||||||||||||||||||||||||||||||
| 1437 | int i = visibleItems.count() - 1; | - | ||||||||||||||||||||||||||||||
| 1438 | while (i > 0
| 0-220 | ||||||||||||||||||||||||||||||
| 1439 | -- never executed: i;--i;never executed: --i; | 0 | ||||||||||||||||||||||||||||||
| 1440 | if (visibleItems.at(i)->index + 1 == modelIndex
| 61-167 | ||||||||||||||||||||||||||||||
| 1441 | - | |||||||||||||||||||||||||||||||
| 1442 | index = visibleItems.count(); | - | ||||||||||||||||||||||||||||||
| 1443 | } executed 61 times by 1 test: else {end of blockExecuted by:
| 61 | ||||||||||||||||||||||||||||||
| 1444 | if (modelIndex <= visibleIndex
| 83-84 | ||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||
| 1446 | visibleIndex += count; | - | ||||||||||||||||||||||||||||||
| 1447 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 1448 | if (item->index != -1
| 0-1786 | ||||||||||||||||||||||||||||||
| 1449 | item->index += count; executed 1786 times by 1 test: item->index += count;Executed by:
| 1786 | ||||||||||||||||||||||||||||||
| 1450 | } executed 1786 times by 1 test: end of blockExecuted by:
| 1786 | ||||||||||||||||||||||||||||||
| 1451 | } executed 84 times by 1 test: end of blockExecuted by:
| 84 | ||||||||||||||||||||||||||||||
| 1452 | return executed 167 times by 1 test: true;return true;Executed by:
executed 167 times by 1 test: return true;Executed by:
| 167 | ||||||||||||||||||||||||||||||
| 1453 | } | - | ||||||||||||||||||||||||||||||
| 1454 | } | - | ||||||||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||||||||
| 1456 | qreal tempPos = isContentFlowReversed()
| 320-773 | ||||||||||||||||||||||||||||||
| 1457 | qreal colPos = 0; | - | ||||||||||||||||||||||||||||||
| 1458 | qreal rowPos = 0; | - | ||||||||||||||||||||||||||||||
| 1459 | int colNum = 0; | - | ||||||||||||||||||||||||||||||
| 1460 | if (visibleItems.count()
| 102-991 | ||||||||||||||||||||||||||||||
| 1461 | if (index < visibleItems.count()
| 61-930 | ||||||||||||||||||||||||||||||
| 1462 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(visibleItems.at(index)); | - | ||||||||||||||||||||||||||||||
| 1463 | colPos = gridItem->colPos(); | - | ||||||||||||||||||||||||||||||
| 1464 | rowPos = gridItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 1465 | colNum = qFloor((colPos+colSize()/2) / colSize()); | - | ||||||||||||||||||||||||||||||
| 1466 | } executed 930 times by 1 test: else {end of blockExecuted by:
| 930 | ||||||||||||||||||||||||||||||
| 1467 | - | |||||||||||||||||||||||||||||||
| 1468 | FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(visibleItems.at(index-1)); | - | ||||||||||||||||||||||||||||||
| 1469 | rowPos = gridItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 1470 | colNum = qFloor((gridItem->colPos()+colSize()/2) / colSize()); | - | ||||||||||||||||||||||||||||||
| 1471 | if (++
| 0-61 | ||||||||||||||||||||||||||||||
| 1472 | colNum = 0; | - | ||||||||||||||||||||||||||||||
| 1473 | rowPos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 1474 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1475 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 1476 | } executed 61 times by 1 test: end of blockExecuted by:
| 61 | ||||||||||||||||||||||||||||||
| 1477 | } | - | ||||||||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||||||||
| 1479 | - | |||||||||||||||||||||||||||||||
| 1480 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 1481 | if (item->index != -1
| 0-17794 | ||||||||||||||||||||||||||||||
| 1482 | item->index += count; | - | ||||||||||||||||||||||||||||||
| 1483 | if (change.isMove()
| 5262-5440 | ||||||||||||||||||||||||||||||
| 1484 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false); executed 5262 times by 1 test: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);Executed by:
| 5262 | ||||||||||||||||||||||||||||||
| 1485 | else | - | ||||||||||||||||||||||||||||||
| 1486 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false); executed 5440 times by 1 test: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);Executed by:
| 5440 | ||||||||||||||||||||||||||||||
| 1487 | } | - | ||||||||||||||||||||||||||||||
| 1488 | } executed 17794 times by 1 test: end of blockExecuted by:
| 17794 | ||||||||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||||||||
| 1490 | int prevVisibleCount = visibleItems.count(); | - | ||||||||||||||||||||||||||||||
| 1491 | if (insertResult->visiblePos.isValid()
| 96-995 | ||||||||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||||||||
| 1493 | int insertionIdx = index; | - | ||||||||||||||||||||||||||||||
| 1494 | int i = count - 1; | - | ||||||||||||||||||||||||||||||
| 1495 | int from = tempPos - buffer - displayMarginBeginning; | - | ||||||||||||||||||||||||||||||
| 1496 | - | |||||||||||||||||||||||||||||||
| 1497 | if (rowPos > from
| 2-83 | ||||||||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||||||||
| 1499 | insertResult->countChangeBeforeVisible += count; | - | ||||||||||||||||||||||||||||||
| 1500 | insertResult->sizeChangesBeforeVisiblePos += ((count + columns - 1) / columns) * rowSize(); | - | ||||||||||||||||||||||||||||||
| 1501 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1502 | while (i >= 0
| 94-371 | ||||||||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||||||||
| 1504 | FxViewItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 1505 | if (change.isMove()
| 0-369 | ||||||||||||||||||||||||||||||
| 1506 | item->index = modelIndex + i; never executed: item->index = modelIndex + i; | 0 | ||||||||||||||||||||||||||||||
| 1507 | if (!item
| 0-371 | ||||||||||||||||||||||||||||||
| 1508 | item = createItem(modelIndex + i, QQmlIncubator::Synchronous); executed 371 times by 1 test: item = createItem(modelIndex + i, QQmlIncubator::Synchronous);Executed by:
| 371 | ||||||||||||||||||||||||||||||
| 1509 | if (!item
| 0-371 | ||||||||||||||||||||||||||||||
| 1510 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||||||||
| 1512 | QQuickItemPrivate::get(item->item)->setCulled(false); | - | ||||||||||||||||||||||||||||||
| 1513 | visibleItems.insert(insertionIdx, item); | - | ||||||||||||||||||||||||||||||
| 1514 | if (insertionIdx == 0
| 15-356 | ||||||||||||||||||||||||||||||
| 1515 | insertResult->changedFirstItem = true; executed 15 times by 1 test: insertResult->changedFirstItem = true;Executed by:
| 15 | ||||||||||||||||||||||||||||||
| 1516 | if (!change.isMove()
| 2-369 | ||||||||||||||||||||||||||||||
| 1517 | addedItems->append(item); | - | ||||||||||||||||||||||||||||||
| 1518 | if (transitioner
| 0-369 | ||||||||||||||||||||||||||||||
| 1519 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); never executed: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); | 0 | ||||||||||||||||||||||||||||||
| 1520 | else | - | ||||||||||||||||||||||||||||||
| 1521 | item->moveTo(QPointF(colPos, rowPos), true); executed 369 times by 1 test: item->moveTo(QPointF(colPos, rowPos), true);Executed by:
| 369 | ||||||||||||||||||||||||||||||
| 1522 | } | - | ||||||||||||||||||||||||||||||
| 1523 | insertResult->sizeChangesBeforeVisiblePos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 1524 | - | |||||||||||||||||||||||||||||||
| 1525 | if (--
| 76-295 | ||||||||||||||||||||||||||||||
| 1526 | colNum = columns - 1; | - | ||||||||||||||||||||||||||||||
| 1527 | rowPos -= rowSize(); | - | ||||||||||||||||||||||||||||||
| 1528 | } executed 76 times by 1 test: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||||||||
| 1529 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 1530 | index++; | - | ||||||||||||||||||||||||||||||
| 1531 | i--; | - | ||||||||||||||||||||||||||||||
| 1532 | } executed 371 times by 1 test: end of blockExecuted by:
| 371 | ||||||||||||||||||||||||||||||
| 1533 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 1534 | - | |||||||||||||||||||||||||||||||
| 1535 | - | |||||||||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||||||||
| 1538 | int firstOkIdx = -1; | - | ||||||||||||||||||||||||||||||
| 1539 | for (int i = 0; i <= insertionIdx
| 0-351 | ||||||||||||||||||||||||||||||
| 1540 | if (visibleItems.at(i)->index + 1 != visibleItems.at(i + 1)->index
| 1-350 | ||||||||||||||||||||||||||||||
| 1541 | firstOkIdx = i + 1; | - | ||||||||||||||||||||||||||||||
| 1542 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||||||||||||||
| 1543 | } | - | ||||||||||||||||||||||||||||||
| 1544 | } executed 350 times by 1 test: end of blockExecuted by:
| 350 | ||||||||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||||||||
| 1546 | for (int i = 0; i < firstOkIdx
| 1-96 | ||||||||||||||||||||||||||||||
| 1547 | FxViewItem *nvItem = visibleItems.takeFirst(); | - | ||||||||||||||||||||||||||||||
| 1548 | addedItems->removeOne(nvItem); | - | ||||||||||||||||||||||||||||||
| 1549 | removeItem(nvItem); | - | ||||||||||||||||||||||||||||||
| 1550 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||||||||
| 1552 | } executed 96 times by 1 test: else {end of blockExecuted by:
| 96 | ||||||||||||||||||||||||||||||
| 1553 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 1554 | int to = buffer+displayMarginEnd+tempPos+size()-1; | - | ||||||||||||||||||||||||||||||
| 1555 | while (i < count
| 44-4253 | ||||||||||||||||||||||||||||||
| 1556 | FxViewItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 1557 | if (change.isMove()
| 366-2851 | ||||||||||||||||||||||||||||||
| 1558 | item->index = modelIndex + i; executed 992 times by 1 test: item->index = modelIndex + i;Executed by:
| 992 | ||||||||||||||||||||||||||||||
| 1559 | bool newItem = !item; | - | ||||||||||||||||||||||||||||||
| 1560 | if (!item
| 992-3217 | ||||||||||||||||||||||||||||||
| 1561 | item = createItem(modelIndex + i, QQmlIncubator::Synchronous); executed 3217 times by 3 tests: item = createItem(modelIndex + i, QQmlIncubator::Synchronous);Executed by:
| 3217 | ||||||||||||||||||||||||||||||
| 1562 | if (!item
| 0-4209 | ||||||||||||||||||||||||||||||
| 1563 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1564 | - | |||||||||||||||||||||||||||||||
| 1565 | QQuickItemPrivate::get(item->item)->setCulled(false); | - | ||||||||||||||||||||||||||||||
| 1566 | visibleItems.insert(index, item); | - | ||||||||||||||||||||||||||||||
| 1567 | if (index == 0
| 261-3948 | ||||||||||||||||||||||||||||||
| 1568 | insertResult->changedFirstItem = true; executed 261 times by 3 tests: insertResult->changedFirstItem = true;Executed by:
| 261 | ||||||||||||||||||||||||||||||
| 1569 | if (change.isMove()
| 1358-2851 | ||||||||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||||||||
| 1571 | - | |||||||||||||||||||||||||||||||
| 1572 | if (newItem
| 0-992 | ||||||||||||||||||||||||||||||
| 1573 | movingIntoView->append(MovedItem(item, change.moveKey(item->index))); executed 58 times by 1 test: movingIntoView->append(MovedItem(item, change.moveKey(item->index)));Executed by:
| 58 | ||||||||||||||||||||||||||||||
| 1574 | } executed 1358 times by 1 test: else {end of blockExecuted by:
| 1358 | ||||||||||||||||||||||||||||||
| 1575 | addedItems->append(item); | - | ||||||||||||||||||||||||||||||
| 1576 | if (transitioner
| 188-2663 | ||||||||||||||||||||||||||||||
| 1577 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); executed 188 times by 1 test: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);Executed by:
| 188 | ||||||||||||||||||||||||||||||
| 1578 | else | - | ||||||||||||||||||||||||||||||
| 1579 | item->moveTo(QPointF(colPos, rowPos), true); executed 2663 times by 3 tests: item->moveTo(QPointF(colPos, rowPos), true);Executed by:
| 2663 | ||||||||||||||||||||||||||||||
| 1580 | } | - | ||||||||||||||||||||||||||||||
| 1581 | insertResult->sizeChangesAfterVisiblePos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||||||||
| 1583 | if (++
| 1170-3039 | ||||||||||||||||||||||||||||||
| 1584 | colNum = 0; | - | ||||||||||||||||||||||||||||||
| 1585 | rowPos += rowSize(); | - | ||||||||||||||||||||||||||||||
| 1586 | } executed 1170 times by 3 tests: end of blockExecuted by:
| 1170 | ||||||||||||||||||||||||||||||
| 1587 | colPos = colNum * colSize(); | - | ||||||||||||||||||||||||||||||
| 1588 | ++index; | - | ||||||||||||||||||||||||||||||
| 1589 | ++i; | - | ||||||||||||||||||||||||||||||
| 1590 | } executed 4209 times by 3 tests: end of blockExecuted by:
| 4209 | ||||||||||||||||||||||||||||||
| 1591 | } executed 997 times by 3 tests: end of blockExecuted by:
| 997 | ||||||||||||||||||||||||||||||
| 1592 | - | |||||||||||||||||||||||||||||||
| 1593 | updateVisibleIndex(); | - | ||||||||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||||||||
| 1595 | return executed 1093 times by 3 tests: visibleItems.count() > prevVisibleCount;return visibleItems.count() > prevVisibleCount;Executed by:
executed 1093 times by 3 tests: return visibleItems.count() > prevVisibleCount;Executed by:
| 1093 | ||||||||||||||||||||||||||||||
| 1596 | } | - | ||||||||||||||||||||||||||||||
| 1597 | - | |||||||||||||||||||||||||||||||
| 1598 | void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) | - | ||||||||||||||||||||||||||||||
| 1599 | { | - | ||||||||||||||||||||||||||||||
| 1600 | if (!transitioner
| 0-268 | ||||||||||||||||||||||||||||||
| 1601 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||||||||
| 1603 | int markerItemIndex = -1; | - | ||||||||||||||||||||||||||||||
| 1604 | for (int i=0; i<visibleItems.count()
| 0-4792 | ||||||||||||||||||||||||||||||
| 1605 | if (visibleItems.at(i)->index == afterModelIndex
| 268-4524 | ||||||||||||||||||||||||||||||
| 1606 | markerItemIndex = i; | - | ||||||||||||||||||||||||||||||
| 1607 | break; executed 268 times by 2 tests: break;Executed by:
| 268 | ||||||||||||||||||||||||||||||
| 1608 | } | - | ||||||||||||||||||||||||||||||
| 1609 | } executed 4524 times by 2 tests: end of blockExecuted by:
| 4524 | ||||||||||||||||||||||||||||||
| 1610 | if (markerItemIndex < 0
| 0-268 | ||||||||||||||||||||||||||||||
| 1611 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||||||||
| 1613 | const qreal viewEndPos = isContentFlowReversed()
| 0-268 | ||||||||||||||||||||||||||||||
| 1614 | int countItemsRemoved = -(removalResult.sizeChangesAfterVisiblePos / rowSize()); | - | ||||||||||||||||||||||||||||||
| 1615 | - | |||||||||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||||||||
| 1617 | int changeBeforeVisible = insertionResult.countChangeBeforeVisible - removalResult.countChangeBeforeVisible; | - | ||||||||||||||||||||||||||||||
| 1618 | if (changeBeforeVisible != 0
| 20-248 | ||||||||||||||||||||||||||||||
| 1619 | countItemsRemoved += (changeBeforeVisible % columns) - (columns - 1); executed 20 times by 1 test: countItemsRemoved += (changeBeforeVisible % columns) - (columns - 1);Executed by:
| 20 | ||||||||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||||||||
| 1621 | countItemsRemoved -= removalResult.countChangeAfterVisibleItems; | - | ||||||||||||||||||||||||||||||
| 1622 | - | |||||||||||||||||||||||||||||||
| 1623 | for (int i=markerItemIndex+1; i<visibleItems.count()
| 8-298 | ||||||||||||||||||||||||||||||
| 1624 | FxGridItemSG *gridItem = static_cast<FxGridItemSG *>(visibleItems.at(i)); | - | ||||||||||||||||||||||||||||||
| 1625 | if (gridItem->position() >= viewEndPos
| 38-260 | ||||||||||||||||||||||||||||||
| 1626 | break; executed 260 times by 1 test: break;Executed by:
| 260 | ||||||||||||||||||||||||||||||
| 1627 | if (!gridItem->transitionScheduledOrRunning()
| 0-38 | ||||||||||||||||||||||||||||||
| 1628 | qreal origRowPos = gridItem->colPos(); | - | ||||||||||||||||||||||||||||||
| 1629 | qreal origColPos = gridItem->rowPos(); | - | ||||||||||||||||||||||||||||||
| 1630 | int indexDiff = gridItem->index - countItemsRemoved; | - | ||||||||||||||||||||||||||||||
| 1631 | gridItem->setPosition((indexDiff % columns) * colSize(), (indexDiff / columns) * rowSize()); | - | ||||||||||||||||||||||||||||||
| 1632 | gridItem->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false); | - | ||||||||||||||||||||||||||||||
| 1633 | gridItem->setPosition(origRowPos, origColPos); | - | ||||||||||||||||||||||||||||||
| 1634 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||||||||
| 1635 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||||||||
| 1636 | } executed 268 times by 2 tests: end of blockExecuted by:
| 268 | ||||||||||||||||||||||||||||||
| 1637 | - | |||||||||||||||||||||||||||||||
| 1638 | bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 1639 | { | - | ||||||||||||||||||||||||||||||
| 1640 | - | |||||||||||||||||||||||||||||||
| 1641 | - | |||||||||||||||||||||||||||||||
| 1642 | return executed 119 times by 1 test: modelIndex < visibleIndex;return modelIndex < visibleIndex;Executed by:
executed 119 times by 1 test: return modelIndex < visibleIndex;Executed by:
| 119 | ||||||||||||||||||||||||||||||
| 1643 | } | - | ||||||||||||||||||||||||||||||
| 1644 | QQuickGridViewAttached *QQuickGridView::qmlAttachedProperties(QObject *obj) | - | ||||||||||||||||||||||||||||||
| 1645 | { | - | ||||||||||||||||||||||||||||||
| 1646 | return executed 48281 times by 4 tests: new QQuickGridViewAttached(obj);return new QQuickGridViewAttached(obj);Executed by:
executed 48281 times by 4 tests: return new QQuickGridViewAttached(obj);Executed by:
| 48281 | ||||||||||||||||||||||||||||||
| 1647 | } | - | ||||||||||||||||||||||||||||||
| 1648 | - | |||||||||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||||||||
| 1650 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |