| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicklistview.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | class FxListItemSG; | - | ||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||
| 13 | class QQuickListViewPrivate : public QQuickItemViewPrivate | - | ||||||||||||||||||||||||||||||
| 14 | { | - | ||||||||||||||||||||||||||||||
| 15 | inline QQuickListView* q_func() { return static_cast<QQuickListView *>(q_ptr); } inline const QQuickListView* q_func() const { return static_cast<const QQuickListView *>(q_ptr); } friend class QQuickListView; | - | ||||||||||||||||||||||||||||||
| 16 | public: | - | ||||||||||||||||||||||||||||||
| 17 | static QQuickListViewPrivate* get(QQuickListView *item) { return executed 46 times by 4 tests: item->d_func();return item->d_func();Executed by:
executed 46 times by 4 tests: }return item->d_func();Executed by:
| 46 | ||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||
| 19 | Qt::Orientation layoutOrientation() const override; | - | ||||||||||||||||||||||||||||||
| 20 | bool isContentFlowReversed() const override; | - | ||||||||||||||||||||||||||||||
| 21 | bool isRightToLeft() const; | - | ||||||||||||||||||||||||||||||
| 22 | bool isBottomToTop() const; | - | ||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||
| 24 | qreal positionAt(int index) const override; | - | ||||||||||||||||||||||||||||||
| 25 | qreal endPositionAt(int index) const override; | - | ||||||||||||||||||||||||||||||
| 26 | qreal originPosition() const override; | - | ||||||||||||||||||||||||||||||
| 27 | qreal lastPosition() const override; | - | ||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||
| 29 | FxViewItem *itemBefore(int modelIndex) const; | - | ||||||||||||||||||||||||||||||
| 30 | QString sectionAt(int modelIndex); | - | ||||||||||||||||||||||||||||||
| 31 | qreal snapPosAt(qreal pos); | - | ||||||||||||||||||||||||||||||
| 32 | FxViewItem *snapItemAt(qreal pos); | - | ||||||||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||||||||
| 34 | void init() override; | - | ||||||||||||||||||||||||||||||
| 35 | void clear() override; | - | ||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||
| 37 | bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override; | - | ||||||||||||||||||||||||||||||
| 38 | bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override; | - | ||||||||||||||||||||||||||||||
| 39 | void visibleItemsChanged() override; | - | ||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||
| 41 | void removeItem(FxViewItem *item); | - | ||||||||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||||||||
| 43 | FxViewItem *newViewItem(int index, QQuickItem *item) override; | - | ||||||||||||||||||||||||||||||
| 44 | void initializeViewItem(FxViewItem *item) override; | - | ||||||||||||||||||||||||||||||
| 45 | bool releaseItem(FxViewItem *item) override; | - | ||||||||||||||||||||||||||||||
| 46 | void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override; | - | ||||||||||||||||||||||||||||||
| 47 | void repositionPackageItemAt(QQuickItem *item, int index) override; | - | ||||||||||||||||||||||||||||||
| 48 | void resetFirstItemPosition(qreal pos = 0.0) override; | - | ||||||||||||||||||||||||||||||
| 49 | void adjustFirstItem(qreal forwards, qreal backwards, int) override; | - | ||||||||||||||||||||||||||||||
| 50 | void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) override; | - | ||||||||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||||||||
| 52 | void createHighlight() override; | - | ||||||||||||||||||||||||||||||
| 53 | void updateHighlight() override; | - | ||||||||||||||||||||||||||||||
| 54 | void resetHighlightPosition() override; | - | ||||||||||||||||||||||||||||||
| 55 | bool movingFromHighlight() override; | - | ||||||||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||||||||
| 57 | void setPosition(qreal pos) override; | - | ||||||||||||||||||||||||||||||
| 58 | void layoutVisibleItems(int fromModelIndex = 0) override; | - | ||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||
| 60 | bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) override; | - | ||||||||||||||||||||||||||||||
| 61 | void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) override; | - | ||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||
| 63 | void updateSectionCriteria() override; | - | ||||||||||||||||||||||||||||||
| 64 | void updateSections() override; | - | ||||||||||||||||||||||||||||||
| 65 | QQuickItem *getSectionItem(const QString §ion); | - | ||||||||||||||||||||||||||||||
| 66 | void releaseSectionItem(QQuickItem *item); | - | ||||||||||||||||||||||||||||||
| 67 | void releaseSectionItems(); | - | ||||||||||||||||||||||||||||||
| 68 | void updateInlineSection(FxListItemSG *); | - | ||||||||||||||||||||||||||||||
| 69 | void updateCurrentSection(); | - | ||||||||||||||||||||||||||||||
| 70 | void updateStickySections(); | - | ||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||
| 72 | qreal headerSize() const override; | - | ||||||||||||||||||||||||||||||
| 73 | qreal footerSize() const override; | - | ||||||||||||||||||||||||||||||
| 74 | bool showHeaderForIndex(int index) const override; | - | ||||||||||||||||||||||||||||||
| 75 | bool showFooterForIndex(int index) const override; | - | ||||||||||||||||||||||||||||||
| 76 | void updateHeader() override; | - | ||||||||||||||||||||||||||||||
| 77 | void updateFooter() override; | - | ||||||||||||||||||||||||||||||
| 78 | bool hasStickyHeader() const override; | - | ||||||||||||||||||||||||||||||
| 79 | bool hasStickyFooter() const override; | - | ||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||
| 81 | void changedVisibleIndex(int newIndex) override; | - | ||||||||||||||||||||||||||||||
| 82 | void initializeCurrentItem() override; | - | ||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||
| 84 | void updateAverage(); | - | ||||||||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||||||||
| 86 | void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &oldGeometry) override; | - | ||||||||||||||||||||||||||||||
| 87 | void fixupPosition() override; | - | ||||||||||||||||||||||||||||||
| 88 | void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override; | - | ||||||||||||||||||||||||||||||
| 89 | bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||||||||||||||||||||||||||
| 90 | QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) override; | - | ||||||||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||||||||
| 92 | QQuickListView::Orientation orient; | - | ||||||||||||||||||||||||||||||
| 93 | qreal visiblePos; | - | ||||||||||||||||||||||||||||||
| 94 | qreal averageSize; | - | ||||||||||||||||||||||||||||||
| 95 | qreal spacing; | - | ||||||||||||||||||||||||||||||
| 96 | QQuickListView::SnapMode snapMode; | - | ||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||
| 98 | QQuickListView::HeaderPositioning headerPositioning; | - | ||||||||||||||||||||||||||||||
| 99 | QQuickListView::FooterPositioning footerPositioning; | - | ||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||
| 101 | QSmoothedAnimation *highlightPosAnimator; | - | ||||||||||||||||||||||||||||||
| 102 | QSmoothedAnimation *highlightWidthAnimator; | - | ||||||||||||||||||||||||||||||
| 103 | QSmoothedAnimation *highlightHeightAnimator; | - | ||||||||||||||||||||||||||||||
| 104 | qreal highlightMoveVelocity; | - | ||||||||||||||||||||||||||||||
| 105 | qreal highlightResizeVelocity; | - | ||||||||||||||||||||||||||||||
| 106 | int highlightResizeDuration; | - | ||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||
| 108 | QQuickViewSection *sectionCriteria; | - | ||||||||||||||||||||||||||||||
| 109 | QString currentSection; | - | ||||||||||||||||||||||||||||||
| 110 | static const int sectionCacheSize = 5; | - | ||||||||||||||||||||||||||||||
| 111 | QQuickItem *sectionCache[sectionCacheSize]; | - | ||||||||||||||||||||||||||||||
| 112 | QQuickItem *currentSectionItem; | - | ||||||||||||||||||||||||||||||
| 113 | QString currentStickySection; | - | ||||||||||||||||||||||||||||||
| 114 | QQuickItem *nextSectionItem; | - | ||||||||||||||||||||||||||||||
| 115 | QString nextStickySection; | - | ||||||||||||||||||||||||||||||
| 116 | QString lastVisibleSection; | - | ||||||||||||||||||||||||||||||
| 117 | QString nextSection; | - | ||||||||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||||||||
| 119 | qreal overshootDist; | - | ||||||||||||||||||||||||||||||
| 120 | bool correctFlick : 1; | - | ||||||||||||||||||||||||||||||
| 121 | bool inFlickCorrection : 1; | - | ||||||||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||||||||
| 123 | QQuickListViewPrivate() | - | ||||||||||||||||||||||||||||||
| 124 | : orient(QQuickListView::Vertical) | - | ||||||||||||||||||||||||||||||
| 125 | , visiblePos(0) | - | ||||||||||||||||||||||||||||||
| 126 | , averageSize(100.0), spacing(0.0) | - | ||||||||||||||||||||||||||||||
| 127 | , snapMode(QQuickListView::NoSnap) | - | ||||||||||||||||||||||||||||||
| 128 | , headerPositioning(QQuickListView::InlineHeader) | - | ||||||||||||||||||||||||||||||
| 129 | , footerPositioning(QQuickListView::InlineFooter) | - | ||||||||||||||||||||||||||||||
| 130 | , highlightPosAnimator(nullptr), highlightWidthAnimator(nullptr), highlightHeightAnimator(nullptr) | - | ||||||||||||||||||||||||||||||
| 131 | , highlightMoveVelocity(400), highlightResizeVelocity(400), highlightResizeDuration(-1) | - | ||||||||||||||||||||||||||||||
| 132 | , sectionCriteria(nullptr), currentSectionItem(nullptr), nextSectionItem(nullptr) | - | ||||||||||||||||||||||||||||||
| 133 | , overshootDist(0.0), correctFlick(false), inFlickCorrection(false) | - | ||||||||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||||||||
| 135 | highlightMoveDuration = -1; | - | ||||||||||||||||||||||||||||||
| 136 | } executed 1920 times by 11 tests: end of blockExecuted by:
| 1920 | ||||||||||||||||||||||||||||||
| 137 | ~QQuickListViewPrivate() { | - | ||||||||||||||||||||||||||||||
| 138 | delete highlightPosAnimator; | - | ||||||||||||||||||||||||||||||
| 139 | delete highlightWidthAnimator; | - | ||||||||||||||||||||||||||||||
| 140 | delete highlightHeightAnimator; | - | ||||||||||||||||||||||||||||||
| 141 | } executed 1912 times by 9 tests: end of blockExecuted by:
| 1912 | ||||||||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||||||||
| 143 | friend class QQuickViewSection; | - | ||||||||||||||||||||||||||||||
| 144 | }; | - | ||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||||||||
| 148 | QQuickViewSection::QQuickViewSection(QQuickListView *parent) | - | ||||||||||||||||||||||||||||||
| 149 | : QObject(parent), m_criteria(FullString), m_delegate(nullptr), m_labelPositioning(InlineLabels) | - | ||||||||||||||||||||||||||||||
| 150 | , m_view(parent ? QQuickListViewPrivate::get(parent) : nullptr) | - | ||||||||||||||||||||||||||||||
| 151 | { | - | ||||||||||||||||||||||||||||||
| 152 | } executed 46 times by 4 tests: end of blockExecuted by:
| 46 | ||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||
| 154 | void QQuickViewSection::setProperty(const QString &property) | - | ||||||||||||||||||||||||||||||
| 155 | { | - | ||||||||||||||||||||||||||||||
| 156 | if (property != m_property
| 0-58 | ||||||||||||||||||||||||||||||
| 157 | m_property = property; | - | ||||||||||||||||||||||||||||||
| 158 | propertyChanged(); | - | ||||||||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||||||||
| 160 | m_view->updateSectionCriteria(); | - | ||||||||||||||||||||||||||||||
| 161 | } executed 58 times by 4 tests: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||||||||
| 162 | } executed 58 times by 4 tests: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||||||||
| 164 | void QQuickViewSection::setCriteria(QQuickViewSection::SectionCriteria criteria) | - | ||||||||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||||||||
| 166 | if (criteria != m_criteria
| 2-8 | ||||||||||||||||||||||||||||||
| 167 | m_criteria = criteria; | - | ||||||||||||||||||||||||||||||
| 168 | criteriaChanged(); | - | ||||||||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||||||||
| 170 | m_view->updateSectionCriteria(); | - | ||||||||||||||||||||||||||||||
| 171 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 172 | } executed 10 times by 3 tests: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||
| 174 | void QQuickViewSection::setDelegate(QQmlComponent *delegate) | - | ||||||||||||||||||||||||||||||
| 175 | { | - | ||||||||||||||||||||||||||||||
| 176 | if (delegate
| 0-42 | ||||||||||||||||||||||||||||||
| 177 | if (m_delegate
| 2-40 | ||||||||||||||||||||||||||||||
| 178 | m_view->releaseSectionItems(); executed 2 times by 1 test: m_view->releaseSectionItems();Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 179 | m_delegate = delegate; | - | ||||||||||||||||||||||||||||||
| 180 | delegateChanged(); | - | ||||||||||||||||||||||||||||||
| 181 | m_view->forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 182 | } executed 42 times by 3 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 183 | } executed 42 times by 3 tests: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||
| 185 | QString QQuickViewSection::sectionString(const QString &value) | - | ||||||||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||||||||
| 187 | if (m_criteria == FirstCharacter
| 12-7392 | ||||||||||||||||||||||||||||||
| 188 | return executed 12 times by 1 test: value.isEmpty() ? QString() : value.at(0);return value.isEmpty() ? QString() : value.at(0);Executed by:
executed 12 times by 1 test: return value.isEmpty() ? QString() : value.at(0);Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 189 | else | - | ||||||||||||||||||||||||||||||
| 190 | return executed 7392 times by 4 tests: value;return value;Executed by:
executed 7392 times by 4 tests: return value;Executed by:
| 7392 | ||||||||||||||||||||||||||||||
| 191 | } | - | ||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||
| 193 | void QQuickViewSection::setLabelPositioning(int l) | - | ||||||||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||||||||
| 195 | if (m_labelPositioning != l
| 8-14 | ||||||||||||||||||||||||||||||
| 196 | m_labelPositioning = l; | - | ||||||||||||||||||||||||||||||
| 197 | labelPositioningChanged(); | - | ||||||||||||||||||||||||||||||
| 198 | m_view->forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 199 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 200 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||||||||
| 204 | class FxListItemSG : public FxViewItem | - | ||||||||||||||||||||||||||||||
| 205 | { | - | ||||||||||||||||||||||||||||||
| 206 | public: | - | ||||||||||||||||||||||||||||||
| 207 | FxListItemSG(QQuickItem *i, QQuickListView *v, bool own) : FxViewItem(i, v, own, static_cast<QQuickItemViewAttached*>(qmlAttachedPropertiesObject<QQuickListView>(i))), view(v) | - | ||||||||||||||||||||||||||||||
| 208 | { | - | ||||||||||||||||||||||||||||||
| 209 | } executed 36217 times by 10 tests: end of blockExecuted by:
| 36217 | ||||||||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||||||||
| 211 | inline QQuickItem *section() const { | - | ||||||||||||||||||||||||||||||
| 212 | return executed 817572 times by 10 tests: item && attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : nullptr;return item && attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : nullptr;Executed by:
executed 817572 times by 10 tests: return item && attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : nullptr;Executed by:
| 817572 | ||||||||||||||||||||||||||||||
| 213 | } | - | ||||||||||||||||||||||||||||||
| 214 | void setSection(QQuickItem *s) { | - | ||||||||||||||||||||||||||||||
| 215 | static_cast<QQuickListViewAttached*>(attached)->m_sectionItem = s; | - | ||||||||||||||||||||||||||||||
| 216 | } executed 226 times by 3 tests: end of blockExecuted by:
| 226 | ||||||||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||||||||
| 218 | qreal position() const override { | - | ||||||||||||||||||||||||||||||
| 219 | if (section()
| 9212-284354 | ||||||||||||||||||||||||||||||
| 220 | if (view->orientation() == QQuickListView::Vertical
| 0-9212 | ||||||||||||||||||||||||||||||
| 221 | return executed 9212 times by 3 tests: (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -section()->height()-section()->y() : section()->y());return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -section()->height()-section()->y() : section()->y());Executed by:
executed 9212 times by 3 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -section()->height()-section()->y() : section()->y());Executed by:
| 9212 | ||||||||||||||||||||||||||||||
| 222 | else | - | ||||||||||||||||||||||||||||||
| 223 | return never executed: (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section()->width()-section()->x() : section()->x());return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section()->width()-section()->x() : section()->x());never executed: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section()->width()-section()->x() : section()->x()); | 0 | ||||||||||||||||||||||||||||||
| 224 | } else { | - | ||||||||||||||||||||||||||||||
| 225 | return executed 284354 times by 10 tests: itemPosition();return itemPosition();Executed by:
executed 284354 times by 10 tests: return itemPosition();Executed by:
| 284354 | ||||||||||||||||||||||||||||||
| 226 | } | - | ||||||||||||||||||||||||||||||
| 227 | } | - | ||||||||||||||||||||||||||||||
| 228 | qreal itemPosition() const { | - | ||||||||||||||||||||||||||||||
| 229 | if (view->orientation() == QQuickListView::Vertical
| 58592-241869 | ||||||||||||||||||||||||||||||
| 230 | return executed 241869 times by 10 tests: (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemHeight()-itemY() : itemY());return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemHeight()-itemY() : itemY());Executed by:
executed 241869 times by 10 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemHeight()-itemY() : itemY());Executed by:
| 241869 | ||||||||||||||||||||||||||||||
| 231 | else | - | ||||||||||||||||||||||||||||||
| 232 | return executed 58592 times by 2 tests: (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemWidth()-itemX() : itemX());return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemWidth()-itemX() : itemX());Executed by:
executed 58592 times by 2 tests: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemWidth()-itemX() : itemX());Executed by:
| 58592 | ||||||||||||||||||||||||||||||
| 233 | } | - | ||||||||||||||||||||||||||||||
| 234 | qreal size() const override { | - | ||||||||||||||||||||||||||||||
| 235 | if (section()
| 5536-305361 | ||||||||||||||||||||||||||||||
| 236 | return executed 5536 times by 3 tests: (view->orientation() == QQuickListView::Vertical ? itemHeight()+section()->height() : itemWidth()+section()->width());return (view->orientation() == QQuickListView::Vertical ? itemHeight()+section()->height() : itemWidth()+section()->width());Executed by:
executed 5536 times by 3 tests: return (view->orientation() == QQuickListView::Vertical ? itemHeight()+section()->height() : itemWidth()+section()->width());Executed by:
| 5536 | ||||||||||||||||||||||||||||||
| 237 | else | - | ||||||||||||||||||||||||||||||
| 238 | return executed 305361 times by 10 tests: (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());Executed by:
executed 305361 times by 10 tests: return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());Executed by:
| 305361 | ||||||||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||||||||
| 240 | qreal itemSize() const { | - | ||||||||||||||||||||||||||||||
| 241 | return executed 3458 times by 10 tests: (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());Executed by:
executed 3458 times by 10 tests: return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());Executed by:
| 3458 | ||||||||||||||||||||||||||||||
| 242 | } | - | ||||||||||||||||||||||||||||||
| 243 | qreal sectionSize() const override { | - | ||||||||||||||||||||||||||||||
| 244 | if (section()
| 194-13500 | ||||||||||||||||||||||||||||||
| 245 | return executed 194 times by 3 tests: (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width());return (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width());Executed by:
executed 194 times by 3 tests: return (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width());Executed by:
| 194 | ||||||||||||||||||||||||||||||
| 246 | return executed 13500 times by 9 tests: 0.0;return 0.0;Executed by:
executed 13500 times by 9 tests: return 0.0;Executed by:
| 13500 | ||||||||||||||||||||||||||||||
| 247 | } | - | ||||||||||||||||||||||||||||||
| 248 | qreal endPosition() const override { | - | ||||||||||||||||||||||||||||||
| 249 | if (view->orientation() == QQuickListView::Vertical
| 48962-223019 | ||||||||||||||||||||||||||||||
| 250 | return executed 223019 times by 10 tests: (view->verticalLayoutDirection() == QQuickItemView::BottomToTopreturn (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemY() : itemY() + itemHeight());Executed by:
executed 223019 times by 10 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemY() : itemY() + itemHeight());Executed by:
| 223019 | ||||||||||||||||||||||||||||||
| 251 | ? -itemY() executed 223019 times by 10 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemY() : itemY() + itemHeight());Executed by:
| 223019 | ||||||||||||||||||||||||||||||
| 252 | : itemY() + itemHeight()); executed 223019 times by 10 tests: return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemY() : itemY() + itemHeight());Executed by:
| 223019 | ||||||||||||||||||||||||||||||
| 253 | } else { | - | ||||||||||||||||||||||||||||||
| 254 | return executed 48962 times by 2 tests: (view->effectiveLayoutDirection() == Qt::RightToLeftreturn (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemX() : itemX() + itemWidth());Executed by:
executed 48962 times by 2 tests: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemX() : itemX() + itemWidth());Executed by:
| 48962 | ||||||||||||||||||||||||||||||
| 255 | ? -itemX() executed 48962 times by 2 tests: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemX() : itemX() + itemWidth());Executed by:
| 48962 | ||||||||||||||||||||||||||||||
| 256 | : itemX() + itemWidth()); executed 48962 times by 2 tests: return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemX() : itemX() + itemWidth());Executed by:
| 48962 | ||||||||||||||||||||||||||||||
| 257 | } | - | ||||||||||||||||||||||||||||||
| 258 | } | - | ||||||||||||||||||||||||||||||
| 259 | void setPosition(qreal pos, bool immediate = false) { | - | ||||||||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||||||||
| 261 | if (section()
| 2669-77366 | ||||||||||||||||||||||||||||||
| 262 | if (view->orientation() == QQuickListView::Vertical
| 0-2669 | ||||||||||||||||||||||||||||||
| 263 | if (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
| 0-2669 | ||||||||||||||||||||||||||||||
| 264 | section()->setY(-section()->height()-pos); never executed: section()->setY(-section()->height()-pos); | 0 | ||||||||||||||||||||||||||||||
| 265 | else | - | ||||||||||||||||||||||||||||||
| 266 | section()->setY(pos); executed 2669 times by 3 tests: section()->setY(pos);Executed by:
| 2669 | ||||||||||||||||||||||||||||||
| 267 | } else { | - | ||||||||||||||||||||||||||||||
| 268 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
| 269 | section()->setX(-section()->width()-pos); never executed: section()->setX(-section()->width()-pos); | 0 | ||||||||||||||||||||||||||||||
| 270 | else | - | ||||||||||||||||||||||||||||||
| 271 | section()->setX(pos); never executed: section()->setX(pos); | 0 | ||||||||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||||||||
| 273 | } | - | ||||||||||||||||||||||||||||||
| 274 | moveTo(pointForPosition(pos), immediate); | - | ||||||||||||||||||||||||||||||
| 275 | } executed 80035 times by 10 tests: end of blockExecuted by:
| 80035 | ||||||||||||||||||||||||||||||
| 276 | void setSize(qreal size) { | - | ||||||||||||||||||||||||||||||
| 277 | if (view->orientation() == QQuickListView::Vertical
| 210-1984 | ||||||||||||||||||||||||||||||
| 278 | item->setHeight(size); executed 1984 times by 10 tests: item->setHeight(size);Executed by:
| 1984 | ||||||||||||||||||||||||||||||
| 279 | else | - | ||||||||||||||||||||||||||||||
| 280 | item->setWidth(size); executed 210 times by 2 tests: item->setWidth(size);Executed by:
| 210 | ||||||||||||||||||||||||||||||
| 281 | } | - | ||||||||||||||||||||||||||||||
| 282 | bool contains(qreal x, qreal y) const override { | - | ||||||||||||||||||||||||||||||
| 283 | return executed 13428 times by 1 test: (x >= itemX() && x < itemX() + itemWidth() &&return (x >= itemX() && x < itemX() + itemWidth() && y >= itemY() && y < itemY() + itemHeight());Executed by:
executed 13428 times by 1 test: return (x >= itemX() && x < itemX() + itemWidth() && y >= itemY() && y < itemY() + itemHeight());Executed by:
| 13428 | ||||||||||||||||||||||||||||||
| 284 | y >= itemY() && y < itemY() + itemHeight()); executed 13428 times by 1 test: return (x >= itemX() && x < itemX() + itemWidth() && y >= itemY() && y < itemY() + itemHeight());Executed by:
| 13428 | ||||||||||||||||||||||||||||||
| 285 | } | - | ||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||
| 287 | QQuickListView *view; | - | ||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||
| 289 | private: | - | ||||||||||||||||||||||||||||||
| 290 | QPointF pointForPosition(qreal pos) const { | - | ||||||||||||||||||||||||||||||
| 291 | if (view->orientation() == QQuickListView::Vertical
| 5091-74944 | ||||||||||||||||||||||||||||||
| 292 | if (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
| 9413-65531 | ||||||||||||||||||||||||||||||
| 293 | if (section()
| 0-9413 | ||||||||||||||||||||||||||||||
| 294 | pos += section()->height(); never executed: pos += section()->height(); | 0 | ||||||||||||||||||||||||||||||
| 295 | return executed 9413 times by 1 test: QPointF(itemX(), -itemHeight() - pos);return QPointF(itemX(), -itemHeight() - pos);Executed by:
executed 9413 times by 1 test: return QPointF(itemX(), -itemHeight() - pos);Executed by:
| 9413 | ||||||||||||||||||||||||||||||
| 296 | } else { | - | ||||||||||||||||||||||||||||||
| 297 | if (section()
| 2669-62862 | ||||||||||||||||||||||||||||||
| 298 | pos += section()->height(); executed 2669 times by 3 tests: pos += section()->height();Executed by:
| 2669 | ||||||||||||||||||||||||||||||
| 299 | return executed 65531 times by 10 tests: QPointF(itemX(), pos);return QPointF(itemX(), pos);Executed by:
executed 65531 times by 10 tests: return QPointF(itemX(), pos);Executed by:
| 65531 | ||||||||||||||||||||||||||||||
| 300 | } | - | ||||||||||||||||||||||||||||||
| 301 | } else { | - | ||||||||||||||||||||||||||||||
| 302 | if (view->effectiveLayoutDirection() == Qt::RightToLeft
| 1915-3176 | ||||||||||||||||||||||||||||||
| 303 | if (section()
| 0-1915 | ||||||||||||||||||||||||||||||
| 304 | pos += section()->width(); never executed: pos += section()->width(); | 0 | ||||||||||||||||||||||||||||||
| 305 | return executed 1915 times by 1 test: QPointF(-itemWidth() - pos, itemY());return QPointF(-itemWidth() - pos, itemY());Executed by:
executed 1915 times by 1 test: return QPointF(-itemWidth() - pos, itemY());Executed by:
| 1915 | ||||||||||||||||||||||||||||||
| 306 | } else { | - | ||||||||||||||||||||||||||||||
| 307 | if (section()
| 0-3176 | ||||||||||||||||||||||||||||||
| 308 | pos += section()->width(); never executed: pos += section()->width(); | 0 | ||||||||||||||||||||||||||||||
| 309 | return executed 3176 times by 2 tests: QPointF(pos, itemY());return QPointF(pos, itemY());Executed by:
executed 3176 times by 2 tests: return QPointF(pos, itemY());Executed by:
| 3176 | ||||||||||||||||||||||||||||||
| 310 | } | - | ||||||||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||||||||
| 312 | } | - | ||||||||||||||||||||||||||||||
| 313 | }; | - | ||||||||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||
| 317 | bool QQuickListViewPrivate::isContentFlowReversed() const | - | ||||||||||||||||||||||||||||||
| 318 | { | - | ||||||||||||||||||||||||||||||
| 319 | return executed 231360 times by 11 tests: isRightToLeft() || isBottomToTop();return isRightToLeft() || isBottomToTop();Executed by:
executed 231360 times by 11 tests: return isRightToLeft() || isBottomToTop();Executed by:
| 231360 | ||||||||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||
| 322 | Qt::Orientation QQuickListViewPrivate::layoutOrientation() const | - | ||||||||||||||||||||||||||||||
| 323 | { | - | ||||||||||||||||||||||||||||||
| 324 | return executed 559523 times by 11 tests: static_cast<Qt::Orientation>(orient);return static_cast<Qt::Orientation>(orient);Executed by:
executed 559523 times by 11 tests: return static_cast<Qt::Orientation>(orient);Executed by:
| 559523 | ||||||||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||||||||
| 327 | bool QQuickListViewPrivate::isRightToLeft() const | - | ||||||||||||||||||||||||||||||
| 328 | { | - | ||||||||||||||||||||||||||||||
| 329 | const QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 330 | return executed 239349 times by 11 tests: orient == QQuickListView::Horizontal && q->effectiveLayoutDirection() == Qt::RightToLeft;return orient == QQuickListView::Horizontal && q->effectiveLayoutDirection() == Qt::RightToLeft;Executed by:
executed 239349 times by 11 tests: return orient == QQuickListView::Horizontal && q->effectiveLayoutDirection() == Qt::RightToLeft;Executed by:
| 239349 | ||||||||||||||||||||||||||||||
| 331 | } | - | ||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||
| 333 | bool QQuickListViewPrivate::isBottomToTop() const | - | ||||||||||||||||||||||||||||||
| 334 | { | - | ||||||||||||||||||||||||||||||
| 335 | return executed 233222 times by 11 tests: orient == QQuickListView::Vertical && verticalLayoutDirection == QQuickItemView::BottomToTop;return orient == QQuickListView::Vertical && verticalLayoutDirection == QQuickItemView::BottomToTop;Executed by:
executed 233222 times by 11 tests: return orient == QQuickListView::Vertical && verticalLayoutDirection == QQuickItemView::BottomToTop;Executed by:
| 233222 | ||||||||||||||||||||||||||||||
| 336 | } | - | ||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||||||||
| 340 | FxViewItem *QQuickListViewPrivate::itemBefore(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 341 | { | - | ||||||||||||||||||||||||||||||
| 342 | if (modelIndex < visibleIndex
| 46-460 | ||||||||||||||||||||||||||||||
| 343 | return executed 46 times by 1 test: nullptr;return nullptr;Executed by:
executed 46 times by 1 test: return nullptr;Executed by:
| 46 | ||||||||||||||||||||||||||||||
| 344 | int idx = 1; | - | ||||||||||||||||||||||||||||||
| 345 | int lastIndex = -1; | - | ||||||||||||||||||||||||||||||
| 346 | while (idx < visibleItems.count()
| 456-3492 | ||||||||||||||||||||||||||||||
| 347 | FxViewItem *item = visibleItems.at(idx); | - | ||||||||||||||||||||||||||||||
| 348 | if (item->index != -1
| 4-3488 | ||||||||||||||||||||||||||||||
| 349 | lastIndex = item->index; executed 3488 times by 3 tests: lastIndex = item->index;Executed by:
| 3488 | ||||||||||||||||||||||||||||||
| 350 | if (item->index == modelIndex
| 4-3488 | ||||||||||||||||||||||||||||||
| 351 | return executed 4 times by 1 test: visibleItems.at(idx-1);return visibleItems.at(idx-1);Executed by:
executed 4 times by 1 test: return visibleItems.at(idx-1);Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 352 | ++idx; | - | ||||||||||||||||||||||||||||||
| 353 | } executed 3488 times by 3 tests: end of blockExecuted by:
| 3488 | ||||||||||||||||||||||||||||||
| 354 | if (lastIndex == modelIndex-1
| 64-392 | ||||||||||||||||||||||||||||||
| 355 | return executed 392 times by 3 tests: visibleItems.constLast();return visibleItems.constLast();Executed by:
executed 392 times by 3 tests: return visibleItems.constLast();Executed by:
| 392 | ||||||||||||||||||||||||||||||
| 356 | return executed 64 times by 3 tests: nullptr;return nullptr;Executed by:
executed 64 times by 3 tests: return nullptr;Executed by:
| 64 | ||||||||||||||||||||||||||||||
| 357 | } | - | ||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||
| 359 | void QQuickListViewPrivate::setPosition(qreal pos) | - | ||||||||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||||||||
| 361 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 362 | if (orient == QQuickListView::Vertical
| 533-5030 | ||||||||||||||||||||||||||||||
| 363 | if (isBottomToTop()
| 208-4822 | ||||||||||||||||||||||||||||||
| 364 | q->QQuickFlickable::setContentY(-pos-size()); executed 208 times by 1 test: q->QQuickFlickable::setContentY(-pos-size());Executed by:
| 208 | ||||||||||||||||||||||||||||||
| 365 | else | - | ||||||||||||||||||||||||||||||
| 366 | q->QQuickFlickable::setContentY(pos); executed 4822 times by 11 tests: q->QQuickFlickable::setContentY(pos);Executed by:
| 4822 | ||||||||||||||||||||||||||||||
| 367 | } else { | - | ||||||||||||||||||||||||||||||
| 368 | if (isRightToLeft()
| 130-403 | ||||||||||||||||||||||||||||||
| 369 | q->QQuickFlickable::setContentX(-pos-size()); executed 130 times by 1 test: q->QQuickFlickable::setContentX(-pos-size());Executed by:
| 130 | ||||||||||||||||||||||||||||||
| 370 | else | - | ||||||||||||||||||||||||||||||
| 371 | q->QQuickFlickable::setContentX(pos); executed 403 times by 2 tests: q->QQuickFlickable::setContentX(pos);Executed by:
| 403 | ||||||||||||||||||||||||||||||
| 372 | } | - | ||||||||||||||||||||||||||||||
| 373 | } | - | ||||||||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||||||||
| 375 | qreal QQuickListViewPrivate::originPosition() const | - | ||||||||||||||||||||||||||||||
| 376 | { | - | ||||||||||||||||||||||||||||||
| 377 | qreal pos = 0; | - | ||||||||||||||||||||||||||||||
| 378 | if (!visibleItems.isEmpty()
| 9076-25232 | ||||||||||||||||||||||||||||||
| 379 | pos = (*visibleItems.constBegin())->position(); | - | ||||||||||||||||||||||||||||||
| 380 | if (visibleIndex > 0
| 4445-20787 | ||||||||||||||||||||||||||||||
| 381 | pos -= visibleIndex * (averageSize + spacing); executed 4445 times by 3 tests: pos -= visibleIndex * (averageSize + spacing);Executed by:
| 4445 | ||||||||||||||||||||||||||||||
| 382 | } executed 25232 times by 10 tests: end of blockExecuted by:
| 25232 | ||||||||||||||||||||||||||||||
| 383 | return executed 34308 times by 11 tests: pos;return pos;Executed by:
executed 34308 times by 11 tests: return pos;Executed by:
| 34308 | ||||||||||||||||||||||||||||||
| 384 | } | - | ||||||||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||||||||
| 386 | qreal QQuickListViewPrivate::lastPosition() const | - | ||||||||||||||||||||||||||||||
| 387 | { | - | ||||||||||||||||||||||||||||||
| 388 | qreal pos = 0; | - | ||||||||||||||||||||||||||||||
| 389 | if (!visibleItems.isEmpty()
| 4366-23622 | ||||||||||||||||||||||||||||||
| 390 | int invisibleCount = | - | ||||||||||||||||||||||||||||||
| 391 | (-0x7fffffff - 1) | - | ||||||||||||||||||||||||||||||
| 392 | ; | - | ||||||||||||||||||||||||||||||
| 393 | int delayRemovedCount = 0; | - | ||||||||||||||||||||||||||||||
| 394 | for (int i = visibleItems.count()-1; i >= 0
| 15-23803 | ||||||||||||||||||||||||||||||
| 395 | FxViewItem *item = visibleItems.at(i); | - | ||||||||||||||||||||||||||||||
| 396 | if (item->index != -1
| 196-23607 | ||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||
| 398 | invisibleCount = model->count() - (item->index + 1 + delayRemovedCount); | - | ||||||||||||||||||||||||||||||
| 399 | break; executed 23607 times by 10 tests: break;Executed by:
| 23607 | ||||||||||||||||||||||||||||||
| 400 | } else if (item->attached->delayRemove()
| 0-196 | ||||||||||||||||||||||||||||||
| 401 | ++delayRemovedCount; | - | ||||||||||||||||||||||||||||||
| 402 | } executed 196 times by 1 test: end of blockExecuted by:
| 196 | ||||||||||||||||||||||||||||||
| 403 | } executed 196 times by 1 test: end of blockExecuted by:
| 196 | ||||||||||||||||||||||||||||||
| 404 | if (invisibleCount ==
| 15-23607 | ||||||||||||||||||||||||||||||
| 405 | (-0x7fffffff - 1)
| 15-23607 | ||||||||||||||||||||||||||||||
| 406 | ) { | - | ||||||||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||||||||
| 408 | invisibleCount = model->count(); | - | ||||||||||||||||||||||||||||||
| 409 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||||||||
| 410 | pos = (*(--visibleItems.constEnd()))->endPosition(); | - | ||||||||||||||||||||||||||||||
| 411 | if (invisibleCount > 0
| 8551-15071 | ||||||||||||||||||||||||||||||
| 412 | pos += invisibleCount * (averageSize + spacing); executed 15071 times by 6 tests: pos += invisibleCount * (averageSize + spacing);Executed by:
| 15071 | ||||||||||||||||||||||||||||||
| 413 | } executed 23622 times by 10 tests: else if (model && model->count()end of blockExecuted by:
| 66-23622 | ||||||||||||||||||||||||||||||
| 414 | pos = (model->count() * averageSize + (model->count()-1) * spacing); | - | ||||||||||||||||||||||||||||||
| 415 | } executed 4300 times by 10 tests: end of blockExecuted by:
| 4300 | ||||||||||||||||||||||||||||||
| 416 | return executed 27988 times by 10 tests: pos;return pos;Executed by:
executed 27988 times by 10 tests: return pos;Executed by:
| 27988 | ||||||||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||
| 419 | qreal QQuickListViewPrivate::positionAt(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 420 | { | - | ||||||||||||||||||||||||||||||
| 421 | if (FxViewItem *item = visibleItem(modelIndex)
| 5319-11425 | ||||||||||||||||||||||||||||||
| 422 | return executed 5319 times by 8 tests: item->position();return item->position();Executed by:
executed 5319 times by 8 tests: return item->position();Executed by:
| 5319 | ||||||||||||||||||||||||||||||
| 423 | } | - | ||||||||||||||||||||||||||||||
| 424 | if (!visibleItems.isEmpty()
| 2238-9187 | ||||||||||||||||||||||||||||||
| 425 | if (modelIndex < visibleIndex
| 1174-8013 | ||||||||||||||||||||||||||||||
| 426 | int count = visibleIndex - modelIndex; | - | ||||||||||||||||||||||||||||||
| 427 | qreal cs = 0; | - | ||||||||||||||||||||||||||||||
| 428 | if (modelIndex == currentIndex
| 0-1154 | ||||||||||||||||||||||||||||||
| 429 | cs = currentItem->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 430 | --count; | - | ||||||||||||||||||||||||||||||
| 431 | } executed 1154 times by 3 tests: end of blockExecuted by:
| 1154 | ||||||||||||||||||||||||||||||
| 432 | return executed 1174 times by 3 tests: (*visibleItems.constBegin())->position() - count * (averageSize + spacing) - cs;return (*visibleItems.constBegin())->position() - count * (averageSize + spacing) - cs;Executed by:
executed 1174 times by 3 tests: return (*visibleItems.constBegin())->position() - count * (averageSize + spacing) - cs;Executed by:
| 1174 | ||||||||||||||||||||||||||||||
| 433 | } else { | - | ||||||||||||||||||||||||||||||
| 434 | int count = modelIndex - findLastVisibleIndex(visibleIndex) - 1; | - | ||||||||||||||||||||||||||||||
| 435 | return executed 8013 times by 6 tests: (*(--visibleItems.constEnd()))->endPosition() + spacing + count * (averageSize + spacing);return (*(--visibleItems.constEnd()))->endPosition() + spacing + count * (averageSize + spacing);Executed by:
executed 8013 times by 6 tests: return (*(--visibleItems.constEnd()))->endPosition() + spacing + count * (averageSize + spacing);Executed by:
| 8013 | ||||||||||||||||||||||||||||||
| 436 | } | - | ||||||||||||||||||||||||||||||
| 437 | } | - | ||||||||||||||||||||||||||||||
| 438 | return executed 2238 times by 10 tests: 0;return 0;Executed by:
executed 2238 times by 10 tests: return 0;Executed by:
| 2238 | ||||||||||||||||||||||||||||||
| 439 | } | - | ||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||
| 441 | qreal QQuickListViewPrivate::endPositionAt(int modelIndex) const | - | ||||||||||||||||||||||||||||||
| 442 | { | - | ||||||||||||||||||||||||||||||
| 443 | if (FxViewItem *item = visibleItem(modelIndex)
| 7739-9775 | ||||||||||||||||||||||||||||||
| 444 | return executed 9775 times by 10 tests: item->endPosition();return item->endPosition();Executed by:
executed 9775 times by 10 tests: return item->endPosition();Executed by:
| 9775 | ||||||||||||||||||||||||||||||
| 445 | if (!visibleItems.isEmpty()
| 1431-6308 | ||||||||||||||||||||||||||||||
| 446 | if (modelIndex < visibleIndex
| 28-1403 | ||||||||||||||||||||||||||||||
| 447 | int count = visibleIndex - modelIndex; | - | ||||||||||||||||||||||||||||||
| 448 | return executed 1403 times by 3 tests: (*visibleItems.constBegin())->position() - (count - 1) * (averageSize + spacing) - spacing;return (*visibleItems.constBegin())->position() - (count - 1) * (averageSize + spacing) - spacing;Executed by:
executed 1403 times by 3 tests: return (*visibleItems.constBegin())->position() - (count - 1) * (averageSize + spacing) - spacing;Executed by:
| 1403 | ||||||||||||||||||||||||||||||
| 449 | } else { | - | ||||||||||||||||||||||||||||||
| 450 | int count = modelIndex - findLastVisibleIndex(visibleIndex) - 1; | - | ||||||||||||||||||||||||||||||
| 451 | return executed 28 times by 1 test: (*(--visibleItems.constEnd()))->endPosition() + count * (averageSize + spacing);return (*(--visibleItems.constEnd()))->endPosition() + count * (averageSize + spacing);Executed by:
executed 28 times by 1 test: return (*(--visibleItems.constEnd()))->endPosition() + count * (averageSize + spacing);Executed by:
| 28 | ||||||||||||||||||||||||||||||
| 452 | } | - | ||||||||||||||||||||||||||||||
| 453 | } | - | ||||||||||||||||||||||||||||||
| 454 | return executed 6308 times by 11 tests: 0;return 0;Executed by:
executed 6308 times by 11 tests: return 0;Executed by:
| 6308 | ||||||||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||
| 457 | QString QQuickListViewPrivate::sectionAt(int modelIndex) | - | ||||||||||||||||||||||||||||||
| 458 | { | - | ||||||||||||||||||||||||||||||
| 459 | if (FxViewItem *item = visibleItem(modelIndex)
| 660-5898 | ||||||||||||||||||||||||||||||
| 460 | return executed 5898 times by 3 tests: item->attached->section();return item->attached->section();Executed by:
executed 5898 times by 3 tests: return item->attached->section();Executed by:
| 5898 | ||||||||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||||||||
| 462 | QString section; | - | ||||||||||||||||||||||||||||||
| 463 | if (sectionCriteria
| 0-660 | ||||||||||||||||||||||||||||||
| 464 | QString propValue = model->stringValue(modelIndex, sectionCriteria->property()); | - | ||||||||||||||||||||||||||||||
| 465 | section = sectionCriteria->sectionString(propValue); | - | ||||||||||||||||||||||||||||||
| 466 | } executed 610 times by 4 tests: end of blockExecuted by:
| 610 | ||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||
| 468 | return executed 660 times by 4 tests: section;return section;Executed by:
executed 660 times by 4 tests: return section;Executed by:
| 660 | ||||||||||||||||||||||||||||||
| 469 | } | - | ||||||||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||||||||
| 471 | qreal QQuickListViewPrivate::snapPosAt(qreal pos) | - | ||||||||||||||||||||||||||||||
| 472 | { | - | ||||||||||||||||||||||||||||||
| 473 | if (FxViewItem *snapItem = snapItemAt(pos)
| 11-1989 | ||||||||||||||||||||||||||||||
| 474 | return executed 1989 times by 1 test: snapItem->position();return snapItem->position();Executed by:
executed 1989 times by 1 test: return snapItem->position();Executed by:
| 1989 | ||||||||||||||||||||||||||||||
| 475 | if (visibleItems.count()
| 0-11 | ||||||||||||||||||||||||||||||
| 476 | qreal firstPos = (*visibleItems.constBegin())->position(); | - | ||||||||||||||||||||||||||||||
| 477 | qreal endPos = (*(--visibleItems.constEnd()))->position(); | - | ||||||||||||||||||||||||||||||
| 478 | if (pos < firstPos
| 0-11 | ||||||||||||||||||||||||||||||
| 479 | return executed 11 times by 1 test: firstPos - qRound((firstPos - pos) / averageSize) * averageSize;return firstPos - qRound((firstPos - pos) / averageSize) * averageSize;Executed by:
executed 11 times by 1 test: return firstPos - qRound((firstPos - pos) / averageSize) * averageSize;Executed by:
| 11 | ||||||||||||||||||||||||||||||
| 480 | } else if (pos > endPos
| 0 | ||||||||||||||||||||||||||||||
| 481 | return never executed: endPos + qRound((pos - endPos) / averageSize) * averageSize;return endPos + qRound((pos - endPos) / averageSize) * averageSize;never executed: return endPos + qRound((pos - endPos) / averageSize) * averageSize; | 0 | ||||||||||||||||||||||||||||||
| 482 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 483 | return never executed: qRound((pos - originPosition()) / averageSize) * averageSize + originPosition();return qRound((pos - originPosition()) / averageSize) * averageSize + originPosition();never executed: return qRound((pos - originPosition()) / averageSize) * averageSize + originPosition(); | 0 | ||||||||||||||||||||||||||||||
| 484 | } | - | ||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||
| 486 | FxViewItem *QQuickListViewPrivate::snapItemAt(qreal pos) | - | ||||||||||||||||||||||||||||||
| 487 | { | - | ||||||||||||||||||||||||||||||
| 488 | FxViewItem *snapItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 489 | qreal prevItemSize = 0; | - | ||||||||||||||||||||||||||||||
| 490 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 491 | if (item->index == -1
| 0-38694 | ||||||||||||||||||||||||||||||
| 492 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 493 | qreal itemTop = item->position(); | - | ||||||||||||||||||||||||||||||
| 494 | if (highlight
| 592-38102 | ||||||||||||||||||||||||||||||
| 495 | return executed 2410 times by 2 tests: item;return item;Executed by:
executed 2410 times by 2 tests: return item;Executed by:
| 2410 | ||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||||||||
| 498 | qreal halfwayToNextItem = itemTop + (item->size()+spacing) / 2; | - | ||||||||||||||||||||||||||||||
| 499 | qreal halfwayToPrevItem = itemTop - (prevItemSize+spacing) / 2; | - | ||||||||||||||||||||||||||||||
| 500 | if (halfwayToNextItem >= pos
| 3286-21909 | ||||||||||||||||||||||||||||||
| 501 | snapItem = item; executed 3286 times by 1 test: snapItem = item;Executed by:
| 3286 | ||||||||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||||||||
| 503 | prevItemSize = item->size(); | - | ||||||||||||||||||||||||||||||
| 504 | } executed 36284 times by 2 tests: end of blockExecuted by:
| 36284 | ||||||||||||||||||||||||||||||
| 505 | return executed 4271 times by 2 tests: snapItem;return snapItem;Executed by:
executed 4271 times by 2 tests: return snapItem;Executed by:
| 4271 | ||||||||||||||||||||||||||||||
| 506 | } | - | ||||||||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||||||||
| 508 | void QQuickListViewPrivate::changedVisibleIndex(int newIndex) | - | ||||||||||||||||||||||||||||||
| 509 | { | - | ||||||||||||||||||||||||||||||
| 510 | visiblePos = positionAt(newIndex); | - | ||||||||||||||||||||||||||||||
| 511 | visibleIndex = newIndex; | - | ||||||||||||||||||||||||||||||
| 512 | } executed 118 times by 3 tests: end of blockExecuted by:
| 118 | ||||||||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||||||||
| 514 | void QQuickListViewPrivate::init() | - | ||||||||||||||||||||||||||||||
| 515 | { | - | ||||||||||||||||||||||||||||||
| 516 | QQuickItemViewPrivate::init(); | - | ||||||||||||||||||||||||||||||
| 517 | ::memset(sectionCache, 0, sizeof(QQuickItem*) * sectionCacheSize); | - | ||||||||||||||||||||||||||||||
| 518 | } executed 1920 times by 11 tests: end of blockExecuted by:
| 1920 | ||||||||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||||||||
| 520 | void QQuickListViewPrivate::clear() | - | ||||||||||||||||||||||||||||||
| 521 | { | - | ||||||||||||||||||||||||||||||
| 522 | for (int i = 0; i < sectionCacheSize
| 4208-21040 | ||||||||||||||||||||||||||||||
| 523 | delete sectionCache[i]; | - | ||||||||||||||||||||||||||||||
| 524 | sectionCache[i] = nullptr; | - | ||||||||||||||||||||||||||||||
| 525 | } executed 21040 times by 11 tests: end of blockExecuted by:
| 21040 | ||||||||||||||||||||||||||||||
| 526 | visiblePos = 0; | - | ||||||||||||||||||||||||||||||
| 527 | releaseSectionItem(currentSectionItem); | - | ||||||||||||||||||||||||||||||
| 528 | currentSectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 529 | releaseSectionItem(nextSectionItem); | - | ||||||||||||||||||||||||||||||
| 530 | nextSectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 531 | lastVisibleSection = QString(); | - | ||||||||||||||||||||||||||||||
| 532 | QQuickItemViewPrivate::clear(); | - | ||||||||||||||||||||||||||||||
| 533 | } executed 4208 times by 11 tests: end of blockExecuted by:
| 4208 | ||||||||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||||||||
| 535 | FxViewItem *QQuickListViewPrivate::newViewItem(int modelIndex, QQuickItem *item) | - | ||||||||||||||||||||||||||||||
| 536 | { | - | ||||||||||||||||||||||||||||||
| 537 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||
| 539 | FxListItemSG *listItem = new FxListItemSG(item, q, false); | - | ||||||||||||||||||||||||||||||
| 540 | listItem->index = modelIndex; | - | ||||||||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||||||||
| 543 | if (sectionCriteria
| 620-33073 | ||||||||||||||||||||||||||||||
| 544 | QString propValue = model->stringValue(modelIndex, sectionCriteria->property()); | - | ||||||||||||||||||||||||||||||
| 545 | QString section = sectionCriteria->sectionString(propValue); | - | ||||||||||||||||||||||||||||||
| 546 | QString prevSection; | - | ||||||||||||||||||||||||||||||
| 547 | QString nextSection; | - | ||||||||||||||||||||||||||||||
| 548 | if (modelIndex > 0
| 114-506 | ||||||||||||||||||||||||||||||
| 549 | if (FxViewItem *item = itemBefore(modelIndex)
| 110-396 | ||||||||||||||||||||||||||||||
| 550 | prevSection = item->attached->section(); executed 396 times by 3 tests: prevSection = item->attached->section();Executed by:
| 396 | ||||||||||||||||||||||||||||||
| 551 | else | - | ||||||||||||||||||||||||||||||
| 552 | prevSection = sectionAt(modelIndex-1); executed 110 times by 3 tests: prevSection = sectionAt(modelIndex-1);Executed by:
| 110 | ||||||||||||||||||||||||||||||
| 553 | } | - | ||||||||||||||||||||||||||||||
| 554 | if (modelIndex < model->count()-1
| 46-574 | ||||||||||||||||||||||||||||||
| 555 | nextSection = sectionAt(modelIndex+1); | - | ||||||||||||||||||||||||||||||
| 556 | } executed 574 times by 4 tests: end of blockExecuted by:
| 574 | ||||||||||||||||||||||||||||||
| 557 | listItem->attached->setSections(prevSection, section, nextSection); | - | ||||||||||||||||||||||||||||||
| 558 | } executed 620 times by 4 tests: end of blockExecuted by:
| 620 | ||||||||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||||||||
| 560 | return executed 33693 times by 10 tests: listItem;return listItem;Executed by:
executed 33693 times by 10 tests: return listItem;Executed by:
| 33693 | ||||||||||||||||||||||||||||||
| 561 | } | - | ||||||||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||||||||
| 563 | void QQuickListViewPrivate::initializeViewItem(FxViewItem *item) | - | ||||||||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||||||||
| 565 | QQuickItemViewPrivate::initializeViewItem(item); | - | ||||||||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||||||||
| 568 | item->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||||||||
| 570 | if (sectionCriteria
| 118-33073 | ||||||||||||||||||||||||||||||
| 571 | if (QString::compare(item->attached->m_prevSection, item->attached->m_section, Qt::CaseInsensitive)
| 206-296 | ||||||||||||||||||||||||||||||
| 572 | updateInlineSection(static_cast<FxListItemSG*>(item)); executed 206 times by 3 tests: updateInlineSection(static_cast<FxListItemSG*>(item));Executed by:
| 206 | ||||||||||||||||||||||||||||||
| 573 | } executed 502 times by 3 tests: end of blockExecuted by:
| 502 | ||||||||||||||||||||||||||||||
| 574 | } executed 33693 times by 10 tests: end of blockExecuted by:
| 33693 | ||||||||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||||||||
| 576 | bool QQuickListViewPrivate::releaseItem(FxViewItem *item) | - | ||||||||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||||||||
| 578 | if (!item
| 2410-33683 | ||||||||||||||||||||||||||||||
| 579 | return executed 7012 times by 11 tests: true;return true;Executed by:
executed 7012 times by 11 tests: return true;Executed by:
| 7012 | ||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||
| 581 | QPointer<QQuickItem> it = item->item; | - | ||||||||||||||||||||||||||||||
| 582 | QQuickListViewAttached *att = static_cast<QQuickListViewAttached*>(item->attached); | - | ||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||
| 584 | bool released = QQuickItemViewPrivate::releaseItem(item); | - | ||||||||||||||||||||||||||||||
| 585 | if (released
| 0-29071 | ||||||||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||||||||
| 587 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 588 | do { | - | ||||||||||||||||||||||||||||||
| 589 | if (!sectionCache[i]
| 132-198 | ||||||||||||||||||||||||||||||
| 590 | sectionCache[i] = att->m_sectionItem; | - | ||||||||||||||||||||||||||||||
| 591 | sectionCache[i]->setVisible(false); | - | ||||||||||||||||||||||||||||||
| 592 | att->m_sectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 593 | break; executed 132 times by 3 tests: break;Executed by:
| 132 | ||||||||||||||||||||||||||||||
| 594 | } | - | ||||||||||||||||||||||||||||||
| 595 | ++i; | - | ||||||||||||||||||||||||||||||
| 596 | } executed 198 times by 2 tests: while (i < sectionCacheSizeend of blockExecuted by:
| 10-198 | ||||||||||||||||||||||||||||||
| 597 | delete att->m_sectionItem; | - | ||||||||||||||||||||||||||||||
| 598 | att->m_sectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 599 | } executed 142 times by 3 tests: end of blockExecuted by:
| 142 | ||||||||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||||||||
| 601 | return executed 31273 times by 9 tests: released;return released;Executed by:
executed 31273 times by 9 tests: return released;Executed by:
| 31273 | ||||||||||||||||||||||||||||||
| 602 | } | - | ||||||||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||||||||
| 604 | bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) | - | ||||||||||||||||||||||||||||||
| 605 | { | - | ||||||||||||||||||||||||||||||
| 606 | qreal itemEnd = visiblePos; | - | ||||||||||||||||||||||||||||||
| 607 | if (visibleItems.count()
| 2190-30181 | ||||||||||||||||||||||||||||||
| 608 | visiblePos = (*visibleItems.constBegin())->position(); | - | ||||||||||||||||||||||||||||||
| 609 | itemEnd = (*(--visibleItems.constEnd()))->endPosition() + spacing; | - | ||||||||||||||||||||||||||||||
| 610 | } executed 30181 times by 7 tests: end of blockExecuted by:
| 30181 | ||||||||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||||||||
| 612 | int modelIndex = findLastVisibleIndex(); | - | ||||||||||||||||||||||||||||||
| 613 | bool haveValidItems = modelIndex >= 0; | - | ||||||||||||||||||||||||||||||
| 614 | modelIndex = modelIndex < 0
| 2190-30181 | ||||||||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||||||||
| 616 | if (haveValidItems
| 60-30181 | ||||||||||||||||||||||||||||||
| 617 | || bufferTo < visiblePos - averageSize - spacing
| 16-30105 | ||||||||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||||||||
| 620 | int count = (fillFrom - itemEnd) / (averageSize + spacing); | - | ||||||||||||||||||||||||||||||
| 621 | int newModelIdx = qBound(0, modelIndex + count, model->count()); | - | ||||||||||||||||||||||||||||||
| 622 | count = newModelIdx - modelIndex; | - | ||||||||||||||||||||||||||||||
| 623 | if (count
| 34-42 | ||||||||||||||||||||||||||||||
| 624 | releaseVisibleItems(); | - | ||||||||||||||||||||||||||||||
| 625 | modelIndex = newModelIdx; | - | ||||||||||||||||||||||||||||||
| 626 | visibleIndex = modelIndex; | - | ||||||||||||||||||||||||||||||
| 627 | visiblePos = itemEnd + count * (averageSize + spacing); | - | ||||||||||||||||||||||||||||||
| 628 | itemEnd = visiblePos; | - | ||||||||||||||||||||||||||||||
| 629 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||||||||
| 630 | } executed 76 times by 1 test: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||||||||
| 632 | QQmlIncubator::IncubationMode incubationMode = doBuffer
| 12752-19619 | ||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||
| 634 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 635 | FxListItemSG *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 636 | qreal pos = itemEnd; | - | ||||||||||||||||||||||||||||||
| 637 | while (modelIndex < model->count()
| 11897-37706 | ||||||||||||||||||||||||||||||
| 638 | if (!(item = static_cast<FxListItemSG*>(createItem(modelIndex, incubationMode)))
| 1783-24026 | ||||||||||||||||||||||||||||||
| 639 | break; executed 1783 times by 3 tests: break;Executed by:
| 1783 | ||||||||||||||||||||||||||||||
| 640 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 685, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: append item" << modelIndex << "pos" << pos << "buffer" << doBuffer << "item" << (QObject *)(item->item); | 0-24026 | ||||||||||||||||||||||||||||||
| 641 | if (!transitioner
| 140-20118 | ||||||||||||||||||||||||||||||
| 642 | item->setPosition(pos, true); executed 23886 times by 9 tests: item->setPosition(pos, true);Executed by:
| 23886 | ||||||||||||||||||||||||||||||
| 643 | if (item->item
| 0-24026 | ||||||||||||||||||||||||||||||
| 644 | QQuickItemPrivate::get(item->item)->setCulled(doBuffer); executed 24026 times by 10 tests: QQuickItemPrivate::get(item->item)->setCulled(doBuffer);Executed by:
| 24026 | ||||||||||||||||||||||||||||||
| 645 | pos += item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 646 | visibleItems.append(item); | - | ||||||||||||||||||||||||||||||
| 647 | ++modelIndex; | - | ||||||||||||||||||||||||||||||
| 648 | changed = true; | - | ||||||||||||||||||||||||||||||
| 649 | } executed 24026 times by 10 tests: end of blockExecuted by:
| 24026 | ||||||||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||||||||
| 651 | if (doBuffer
| 1761-19619 | ||||||||||||||||||||||||||||||
| 652 | return executed 1761 times by 3 tests: changed;return changed;Executed by:
executed 1761 times by 3 tests: return changed;Executed by:
| 1761 | ||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||
| 654 | while (visibleIndex > 0
| 0-25180 | ||||||||||||||||||||||||||||||
| 655 | if (!(item = static_cast<FxListItemSG*>(createItem(visibleIndex-1, incubationMode)))
| 147-1681 | ||||||||||||||||||||||||||||||
| 656 | break; executed 147 times by 1 test: break;Executed by:
| 147 | ||||||||||||||||||||||||||||||
| 657 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 702, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos << "buffer" << doBuffer << "item" << (QObject *)(item->item); | 0-1681 | ||||||||||||||||||||||||||||||
| 658 | --visibleIndex; | - | ||||||||||||||||||||||||||||||
| 659 | visiblePos -= item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 660 | if (!transitioner
| 0-1673 | ||||||||||||||||||||||||||||||
| 661 | item->setPosition(visiblePos, true); executed 1681 times by 2 tests: item->setPosition(visiblePos, true);Executed by:
| 1681 | ||||||||||||||||||||||||||||||
| 662 | if (item->item
| 0-1681 | ||||||||||||||||||||||||||||||
| 663 | QQuickItemPrivate::get(item->item)->setCulled(doBuffer); executed 1681 times by 2 tests: QQuickItemPrivate::get(item->item)->setCulled(doBuffer);Executed by:
| 1681 | ||||||||||||||||||||||||||||||
| 664 | visibleItems.prepend(item); | - | ||||||||||||||||||||||||||||||
| 665 | changed = true; | - | ||||||||||||||||||||||||||||||
| 666 | } executed 1681 times by 2 tests: end of blockExecuted by:
| 1681 | ||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||
| 668 | return executed 30610 times by 10 tests: changed;return changed;Executed by:
executed 30610 times by 10 tests: return changed;Executed by:
| 30610 | ||||||||||||||||||||||||||||||
| 669 | } | - | ||||||||||||||||||||||||||||||
| 670 | - | |||||||||||||||||||||||||||||||
| 671 | void QQuickListViewPrivate::removeItem(FxViewItem *item) | - | ||||||||||||||||||||||||||||||
| 672 | { | - | ||||||||||||||||||||||||||||||
| 673 | if (item->transitionScheduledOrRunning()
| 14-2578 | ||||||||||||||||||||||||||||||
| 674 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 719, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "\tnot releasing animating item" << item->index << (QObject *)(item->item); | 0-14 | ||||||||||||||||||||||||||||||
| 675 | item->releaseAfterTransition = true; | - | ||||||||||||||||||||||||||||||
| 676 | releasePendingTransition.append(item); | - | ||||||||||||||||||||||||||||||
| 677 | } executed 14 times by 1 test: else {end of blockExecuted by:
| 14 | ||||||||||||||||||||||||||||||
| 678 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 723, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "\treleasing stationary item" << item->index << (QObject *)(item->item); | 0-2578 | ||||||||||||||||||||||||||||||
| 679 | releaseItem(item); | - | ||||||||||||||||||||||||||||||
| 680 | } executed 2578 times by 2 tests: end of blockExecuted by:
| 2578 | ||||||||||||||||||||||||||||||
| 681 | } | - | ||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||
| 683 | bool QQuickListViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) | - | ||||||||||||||||||||||||||||||
| 684 | { | - | ||||||||||||||||||||||||||||||
| 685 | FxViewItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 686 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||
| 692 | int index = 0; | - | ||||||||||||||||||||||||||||||
| 693 | while (visibleItems.count() > 1
| 0-20597 | ||||||||||||||||||||||||||||||
| 694 | && (
| 0-20597 | ||||||||||||||||||||||||||||||
| 695 | if (item->attached->delayRemove()
| 0-1300 | ||||||||||||||||||||||||||||||
| 696 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | if (item->size() > 0
| 8-1292 | ||||||||||||||||||||||||||||||
| 699 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 744, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition(); | 0-1292 | ||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||
| 701 | while (item
| 0-1296 | ||||||||||||||||||||||||||||||
| 702 | if (item->index != -1
| 0-1296 | ||||||||||||||||||||||||||||||
| 703 | visibleIndex++; executed 1296 times by 2 tests: visibleIndex++;Executed by:
| 1296 | ||||||||||||||||||||||||||||||
| 704 | visibleItems.removeAt(index); | - | ||||||||||||||||||||||||||||||
| 705 | removeItem(item); | - | ||||||||||||||||||||||||||||||
| 706 | if (index == 0
| 4-1292 | ||||||||||||||||||||||||||||||
| 707 | break; executed 1292 times by 2 tests: break;Executed by:
| 1292 | ||||||||||||||||||||||||||||||
| 708 | item = visibleItems.at(--index); | - | ||||||||||||||||||||||||||||||
| 709 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 710 | changed = true; | - | ||||||||||||||||||||||||||||||
| 711 | } executed 1292 times by 2 tests: else {end of blockExecuted by:
| 1292 | ||||||||||||||||||||||||||||||
| 712 | index++; | - | ||||||||||||||||||||||||||||||
| 713 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 714 | } | - | ||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||
| 716 | while (visibleItems.count() > 1
| 0-20492 | ||||||||||||||||||||||||||||||
| 717 | if (item->attached->delayRemove()
| 0-1197 | ||||||||||||||||||||||||||||||
| 718 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 719 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 764, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "refill: remove last" << visibleIndex+visibleItems.count()-1 << item->position() << (QObject *)(item->item); | 0-1197 | ||||||||||||||||||||||||||||||
| 720 | visibleItems.removeLast(); | - | ||||||||||||||||||||||||||||||
| 721 | removeItem(item); | - | ||||||||||||||||||||||||||||||
| 722 | changed = true; | - | ||||||||||||||||||||||||||||||
| 723 | } executed 1197 times by 2 tests: end of blockExecuted by:
| 1197 | ||||||||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||||||||
| 725 | return executed 19619 times by 10 tests: changed;return changed;Executed by:
executed 19619 times by 10 tests: return changed;Executed by:
| 19619 | ||||||||||||||||||||||||||||||
| 726 | } | - | ||||||||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||||||||
| 728 | void QQuickListViewPrivate::visibleItemsChanged() | - | ||||||||||||||||||||||||||||||
| 729 | { | - | ||||||||||||||||||||||||||||||
| 730 | if (visibleItems.count()
| 0-5566 | ||||||||||||||||||||||||||||||
| 731 | visiblePos = (*visibleItems.constBegin())->position(); executed 5566 times by 10 tests: visiblePos = (*visibleItems.constBegin())->position();Executed by:
| 5566 | ||||||||||||||||||||||||||||||
| 732 | updateAverage(); | - | ||||||||||||||||||||||||||||||
| 733 | if (currentIndex >= 0
| 290-3918 | ||||||||||||||||||||||||||||||
| 734 | static_cast<FxListItemSG*>(currentItem)->setPosition(positionAt(currentIndex)); | - | ||||||||||||||||||||||||||||||
| 735 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 736 | } executed 901 times by 3 tests: end of blockExecuted by:
| 901 | ||||||||||||||||||||||||||||||
| 737 | if (sectionCriteria
| 201-5365 | ||||||||||||||||||||||||||||||
| 738 | updateCurrentSection(); executed 201 times by 4 tests: updateCurrentSection();Executed by:
| 201 | ||||||||||||||||||||||||||||||
| 739 | updateUnrequestedPositions(); | - | ||||||||||||||||||||||||||||||
| 740 | } executed 5566 times by 10 tests: end of blockExecuted by:
| 5566 | ||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||
| 742 | void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex) | - | ||||||||||||||||||||||||||||||
| 743 | { | - | ||||||||||||||||||||||||||||||
| 744 | if (!visibleItems.isEmpty()
| 124-3341 | ||||||||||||||||||||||||||||||
| 745 | const qreal from = isContentFlowReversed()
| 370-2971 | ||||||||||||||||||||||||||||||
| 746 | const qreal to = isContentFlowReversed()
| 370-2971 | ||||||||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||||||||
| 748 | FxViewItem *firstItem = *visibleItems.constBegin(); | - | ||||||||||||||||||||||||||||||
| 749 | bool fixedCurrent = currentItem
| 23-3318 | ||||||||||||||||||||||||||||||
| 750 | qreal sum = firstItem->size(); | - | ||||||||||||||||||||||||||||||
| 751 | qreal pos = firstItem->position() + firstItem->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 752 | firstItem->setVisible(firstItem->endPosition() >= from && firstItem->position() <= to); | - | ||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||
| 754 | for (int i=1; i < visibleItems.count()
| 3341-39094 | ||||||||||||||||||||||||||||||
| 755 | FxListItemSG *item = static_cast<FxListItemSG*>(visibleItems.at(i)); | - | ||||||||||||||||||||||||||||||
| 756 | if (item->index >= fromModelIndex
| 2191-36903 | ||||||||||||||||||||||||||||||
| 757 | item->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 758 | item->setVisible(item->endPosition() >= from && item->position() <= to); | - | ||||||||||||||||||||||||||||||
| 759 | } executed 36903 times by 6 tests: end of blockExecuted by:
| 36903 | ||||||||||||||||||||||||||||||
| 760 | pos += item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 761 | sum += item->size(); | - | ||||||||||||||||||||||||||||||
| 762 | fixedCurrent = fixedCurrent
| 201-29997 | ||||||||||||||||||||||||||||||
| 763 | } executed 39094 times by 6 tests: end of blockExecuted by:
| 39094 | ||||||||||||||||||||||||||||||
| 764 | averageSize = qRound(sum / visibleItems.count()); | - | ||||||||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||||||||
| 767 | if (currentIndex >= 0
| 2-3320 | ||||||||||||||||||||||||||||||
| 768 | static_cast< executed 385 times by 2 tests: FxListItemSG*>(currentItem)->setPosition(positionAt(currentIndex));static_cast<FxListItemSG*>(currentItem)->setPosition(positionAt(currentIndex));Executed by:
executed 385 times by 2 tests: static_cast<FxListItemSG*>(currentItem)->setPosition(positionAt(currentIndex));Executed by:
| 385 | ||||||||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||||||||
| 770 | updateCurrentSection(); | - | ||||||||||||||||||||||||||||||
| 771 | updateStickySections(); | - | ||||||||||||||||||||||||||||||
| 772 | } executed 3341 times by 7 tests: end of blockExecuted by:
| 3341 | ||||||||||||||||||||||||||||||
| 773 | } executed 3465 times by 7 tests: end of blockExecuted by:
| 3465 | ||||||||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||||||||
| 775 | void QQuickListViewPrivate::repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) | - | ||||||||||||||||||||||||||||||
| 776 | { | - | ||||||||||||||||||||||||||||||
| 777 | static_cast<FxListItemSG *>(item)->setPosition(positionAt(index) + sizeBuffer); | - | ||||||||||||||||||||||||||||||
| 778 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||||||||
| 780 | void QQuickListViewPrivate::repositionPackageItemAt(QQuickItem *item, int index) | - | ||||||||||||||||||||||||||||||
| 781 | { | - | ||||||||||||||||||||||||||||||
| 782 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 783 | qreal pos = position(); | - | ||||||||||||||||||||||||||||||
| 784 | if (orient == QQuickListView::Vertical
| 0-342 | ||||||||||||||||||||||||||||||
| 785 | if (item->y() + item->height() > pos
| 16-320 | ||||||||||||||||||||||||||||||
| 786 | if (isBottomToTop()
| 4-300 | ||||||||||||||||||||||||||||||
| 787 | item->setY(-positionAt(index)-item->height()); executed 4 times by 1 test: item->setY(-positionAt(index)-item->height());Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 788 | else | - | ||||||||||||||||||||||||||||||
| 789 | item->setY(positionAt(index)); executed 300 times by 2 tests: item->setY(positionAt(index));Executed by:
| 300 | ||||||||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||||||||
| 791 | } executed 342 times by 2 tests: else {end of blockExecuted by:
| 342 | ||||||||||||||||||||||||||||||
| 792 | if (item->x() + item->width() > pos
| 0 | ||||||||||||||||||||||||||||||
| 793 | if (isRightToLeft()
| 0 | ||||||||||||||||||||||||||||||
| 794 | item->setX(-positionAt(index)-item->width()); never executed: item->setX(-positionAt(index)-item->width()); | 0 | ||||||||||||||||||||||||||||||
| 795 | else | - | ||||||||||||||||||||||||||||||
| 796 | item->setX(positionAt(index)); never executed: item->setX(positionAt(index)); | 0 | ||||||||||||||||||||||||||||||
| 797 | } | - | ||||||||||||||||||||||||||||||
| 798 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 799 | } | - | ||||||||||||||||||||||||||||||
| 800 | - | |||||||||||||||||||||||||||||||
| 801 | void QQuickListViewPrivate::resetFirstItemPosition(qreal pos) | - | ||||||||||||||||||||||||||||||
| 802 | { | - | ||||||||||||||||||||||||||||||
| 803 | FxListItemSG *item = static_cast<FxListItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 804 | item->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 805 | } executed 817 times by 3 tests: end of blockExecuted by:
| 817 | ||||||||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||||||||
| 807 | void QQuickListViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int) | - | ||||||||||||||||||||||||||||||
| 808 | { | - | ||||||||||||||||||||||||||||||
| 809 | if (!visibleItems.count()
| 0-1443 | ||||||||||||||||||||||||||||||
| 810 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 811 | qreal diff = forwards - backwards; | - | ||||||||||||||||||||||||||||||
| 812 | static_cast<FxListItemSG*>(visibleItems.constFirst())->setPosition(visibleItems.constFirst()->position() + diff); | - | ||||||||||||||||||||||||||||||
| 813 | } executed 1443 times by 2 tests: end of blockExecuted by:
| 1443 | ||||||||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||||||||
| 815 | void QQuickListViewPrivate::updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) | - | ||||||||||||||||||||||||||||||
| 816 | { | - | ||||||||||||||||||||||||||||||
| 817 | if (item != visibleItems.constFirst()
| 28-78 | ||||||||||||||||||||||||||||||
| 818 | QQuickItemViewPrivate::updateSizeChangesBeforeVisiblePos(item, removeResult); executed 28 times by 1 test: QQuickItemViewPrivate::updateSizeChangesBeforeVisiblePos(item, removeResult);Executed by:
| 28 | ||||||||||||||||||||||||||||||
| 819 | } executed 106 times by 1 test: end of blockExecuted by:
| 106 | ||||||||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||||||||
| 821 | void QQuickListViewPrivate::createHighlight() | - | ||||||||||||||||||||||||||||||
| 822 | { | - | ||||||||||||||||||||||||||||||
| 823 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 824 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 825 | if (highlight
| 2200-4924 | ||||||||||||||||||||||||||||||
| 826 | if (trackedItem == highlight
| 0-2200 | ||||||||||||||||||||||||||||||
| 827 | trackedItem = nullptr; executed 2200 times by 9 tests: trackedItem = nullptr;Executed by:
| 2200 | ||||||||||||||||||||||||||||||
| 828 | delete highlight; | - | ||||||||||||||||||||||||||||||
| 829 | highlight = nullptr; | - | ||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||
| 831 | delete highlightPosAnimator; | - | ||||||||||||||||||||||||||||||
| 832 | delete highlightWidthAnimator; | - | ||||||||||||||||||||||||||||||
| 833 | delete highlightHeightAnimator; | - | ||||||||||||||||||||||||||||||
| 834 | highlightPosAnimator = nullptr; | - | ||||||||||||||||||||||||||||||
| 835 | highlightWidthAnimator = nullptr; | - | ||||||||||||||||||||||||||||||
| 836 | highlightHeightAnimator = nullptr; | - | ||||||||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||||||||
| 838 | changed = true; | - | ||||||||||||||||||||||||||||||
| 839 | } executed 2200 times by 9 tests: end of blockExecuted by:
| 2200 | ||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||
| 841 | if (currentItem
| 2212-4912 | ||||||||||||||||||||||||||||||
| 842 | QQuickItem *item = createHighlightItem(); | - | ||||||||||||||||||||||||||||||
| 843 | if (item
| 8-2204 | ||||||||||||||||||||||||||||||
| 844 | FxListItemSG *newHighlight = new FxListItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 845 | newHighlight->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||||||||
| 847 | if (autoHighlight
| 10-2194 | ||||||||||||||||||||||||||||||
| 848 | newHighlight->setSize(static_cast<FxListItemSG*>(currentItem)->itemSize()); | - | ||||||||||||||||||||||||||||||
| 849 | newHighlight->setPosition(static_cast<FxListItemSG*>(currentItem)->itemPosition()); | - | ||||||||||||||||||||||||||||||
| 850 | } executed 2194 times by 10 tests: end of blockExecuted by:
| 2194 | ||||||||||||||||||||||||||||||
| 851 | const QLatin1String posProp(orient == QQuickListView::Vertical ? "y" : "x"); | - | ||||||||||||||||||||||||||||||
| 852 | highlightPosAnimator = new QSmoothedAnimation; | - | ||||||||||||||||||||||||||||||
| 853 | highlightPosAnimator->target = QQmlProperty(item, posProp); | - | ||||||||||||||||||||||||||||||
| 854 | highlightPosAnimator->velocity = highlightMoveVelocity; | - | ||||||||||||||||||||||||||||||
| 855 | highlightPosAnimator->userDuration = highlightMoveDuration; | - | ||||||||||||||||||||||||||||||
| 856 | - | |||||||||||||||||||||||||||||||
| 857 | highlightWidthAnimator = new QSmoothedAnimation; | - | ||||||||||||||||||||||||||||||
| 858 | highlightWidthAnimator->velocity = highlightResizeVelocity; | - | ||||||||||||||||||||||||||||||
| 859 | highlightWidthAnimator->userDuration = highlightResizeDuration; | - | ||||||||||||||||||||||||||||||
| 860 | highlightWidthAnimator->target = QQmlProperty(item, ([]() noexcept -> QString { enum { Size = sizeof(u"" "width")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "width" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 2204 times by 10 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 2204 times by 10 tests: }()));return qstring_literal_temp;Executed by:
| 2204 | ||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||
| 862 | highlightHeightAnimator = new QSmoothedAnimation; | - | ||||||||||||||||||||||||||||||
| 863 | highlightHeightAnimator->velocity = highlightResizeVelocity; | - | ||||||||||||||||||||||||||||||
| 864 | highlightHeightAnimator->userDuration = highlightResizeDuration; | - | ||||||||||||||||||||||||||||||
| 865 | highlightHeightAnimator->target = QQmlProperty(item, ([]() noexcept -> QString { enum { Size = sizeof(u"" "height")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "height" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 2204 times by 10 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 2204 times by 10 tests: }()));return qstring_literal_temp;Executed by:
| 2204 | ||||||||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||||||||
| 867 | highlight = newHighlight; | - | ||||||||||||||||||||||||||||||
| 868 | changed = true; | - | ||||||||||||||||||||||||||||||
| 869 | } executed 2204 times by 10 tests: end of blockExecuted by:
| 2204 | ||||||||||||||||||||||||||||||
| 870 | } executed 2212 times by 10 tests: end of blockExecuted by:
| 2212 | ||||||||||||||||||||||||||||||
| 871 | if (changed
| 2722-4402 | ||||||||||||||||||||||||||||||
| 872 | q->highlightItemChanged(); executed 4402 times by 10 tests: q->highlightItemChanged();Executed by:
| 4402 | ||||||||||||||||||||||||||||||
| 873 | } executed 7124 times by 11 tests: end of blockExecuted by:
| 7124 | ||||||||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||||||||
| 875 | void QQuickListViewPrivate::updateHighlight() | - | ||||||||||||||||||||||||||||||
| 876 | { | - | ||||||||||||||||||||||||||||||
| 877 | applyPendingChanges(); | - | ||||||||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||||||||
| 879 | if ((!currentItem
| 27-11043 | ||||||||||||||||||||||||||||||
| 880 | createHighlight(); executed 2254 times by 10 tests: createHighlight();Executed by:
| 2254 | ||||||||||||||||||||||||||||||
| 881 | bool strictHighlight = haveHighlightRange
| 18-9762 | ||||||||||||||||||||||||||||||
| 882 | if (currentItem
| 4-11043 | ||||||||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||||||||
| 884 | FxListItemSG *listItem = static_cast<FxListItemSG*>(currentItem); | - | ||||||||||||||||||||||||||||||
| 885 | highlightPosAnimator->to = isContentFlowReversed()
| 1124-9789 | ||||||||||||||||||||||||||||||
| 886 | ? -listItem->itemPosition()-listItem->itemSize() | - | ||||||||||||||||||||||||||||||
| 887 | : listItem->itemPosition(); | - | ||||||||||||||||||||||||||||||
| 888 | highlightWidthAnimator->to = listItem->item->width(); | - | ||||||||||||||||||||||||||||||
| 889 | highlightHeightAnimator->to = listItem->item->height(); | - | ||||||||||||||||||||||||||||||
| 890 | if (orient == QQuickListView::Vertical
| 977-9936 | ||||||||||||||||||||||||||||||
| 891 | if (highlight->item->width() == 0
| 1935-8001 | ||||||||||||||||||||||||||||||
| 892 | highlight->item->setWidth(currentItem->item->width()); executed 1935 times by 10 tests: highlight->item->setWidth(currentItem->item->width());Executed by:
| 1935 | ||||||||||||||||||||||||||||||
| 893 | } executed 9936 times by 10 tests: else {end of blockExecuted by:
| 9936 | ||||||||||||||||||||||||||||||
| 894 | if (highlight->item->height() == 0
| 178-799 | ||||||||||||||||||||||||||||||
| 895 | highlight->item->setHeight(currentItem->item->height()); executed 178 times by 2 tests: highlight->item->setHeight(currentItem->item->height());Executed by:
| 178 | ||||||||||||||||||||||||||||||
| 896 | } executed 977 times by 2 tests: end of blockExecuted by:
| 977 | ||||||||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||||||||
| 898 | highlightPosAnimator->restart(); | - | ||||||||||||||||||||||||||||||
| 899 | highlightWidthAnimator->restart(); | - | ||||||||||||||||||||||||||||||
| 900 | highlightHeightAnimator->restart(); | - | ||||||||||||||||||||||||||||||
| 901 | } executed 10913 times by 10 tests: end of blockExecuted by:
| 10913 | ||||||||||||||||||||||||||||||
| 902 | updateTrackedItem(); | - | ||||||||||||||||||||||||||||||
| 903 | } executed 11122 times by 10 tests: end of blockExecuted by:
| 11122 | ||||||||||||||||||||||||||||||
| 904 | - | |||||||||||||||||||||||||||||||
| 905 | void QQuickListViewPrivate::resetHighlightPosition() | - | ||||||||||||||||||||||||||||||
| 906 | { | - | ||||||||||||||||||||||||||||||
| 907 | if (highlight
| 0-1930 | ||||||||||||||||||||||||||||||
| 908 | static_cast< executed 1930 times by 10 tests: FxListItemSG*>(highlight)->setPosition(static_cast<FxListItemSG*>(currentItem)->itemPosition());static_cast<FxListItemSG*>(highlight)->setPosition(static_cast<FxListItemSG*>(currentItem)->itemPosition());Executed by:
executed 1930 times by 10 tests: static_cast<FxListItemSG*>(highlight)->setPosition(static_cast<FxListItemSG*>(currentItem)->itemPosition());Executed by:
| 1930 | ||||||||||||||||||||||||||||||
| 909 | } executed 1930 times by 10 tests: end of blockExecuted by:
| 1930 | ||||||||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||||||||
| 911 | bool QQuickListViewPrivate::movingFromHighlight() | - | ||||||||||||||||||||||||||||||
| 912 | { | - | ||||||||||||||||||||||||||||||
| 913 | if (!haveHighlightRange
| 2-2893 | ||||||||||||||||||||||||||||||
| 914 | return executed 2895 times by 7 tests: false;return false;Executed by:
executed 2895 times by 7 tests: return false;Executed by:
| 2895 | ||||||||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||||||||
| 916 | return executed 126 times by 2 tests: (highlightPosAnimator && highlightPosAnimator->isRunning()) ||return (highlightPosAnimator && highlightPosAnimator->isRunning()) || (highlightHeightAnimator && highlightHeightAnimator->isRunning()) || (highlightWidthAnimator && highlightWidthAnimator->isRunning());Executed by:
executed 126 times by 2 tests: return (highlightPosAnimator && highlightPosAnimator->isRunning()) || (highlightHeightAnimator && highlightHeightAnimator->isRunning()) || (highlightWidthAnimator && highlightWidthAnimator->isRunning());Executed by:
| 126 | ||||||||||||||||||||||||||||||
| 917 | (highlightHeightAnimator && highlightHeightAnimator->isRunning()) || executed 126 times by 2 tests: return (highlightPosAnimator && highlightPosAnimator->isRunning()) || (highlightHeightAnimator && highlightHeightAnimator->isRunning()) || (highlightWidthAnimator && highlightWidthAnimator->isRunning());Executed by:
| 126 | ||||||||||||||||||||||||||||||
| 918 | (highlightWidthAnimator && highlightWidthAnimator->isRunning()); executed 126 times by 2 tests: return (highlightPosAnimator && highlightPosAnimator->isRunning()) || (highlightHeightAnimator && highlightHeightAnimator->isRunning()) || (highlightWidthAnimator && highlightWidthAnimator->isRunning());Executed by:
| 126 | ||||||||||||||||||||||||||||||
| 919 | } | - | ||||||||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||||||||
| 922 | QQuickItem * QQuickListViewPrivate::getSectionItem(const QString §ion) | - | ||||||||||||||||||||||||||||||
| 923 | { | - | ||||||||||||||||||||||||||||||
| 924 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 925 | QQuickItem *sectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 926 | int i = sectionCacheSize-1; | - | ||||||||||||||||||||||||||||||
| 927 | while (i >= 0
| 20-1008 | ||||||||||||||||||||||||||||||
| 928 | -- executed 988 times by 3 tests: i;--i;Executed by:
executed 988 times by 3 tests: --i;Executed by:
| 988 | ||||||||||||||||||||||||||||||
| 929 | if (i >= 0
| 20-182 | ||||||||||||||||||||||||||||||
| 930 | sectionItem = sectionCache[i]; | - | ||||||||||||||||||||||||||||||
| 931 | sectionCache[i] = nullptr; | - | ||||||||||||||||||||||||||||||
| 932 | sectionItem->setVisible(true); | - | ||||||||||||||||||||||||||||||
| 933 | QQmlContext *context = QQmlEngine::contextForObject(sectionItem)->parentContext(); | - | ||||||||||||||||||||||||||||||
| 934 | context->setContextProperty(QLatin1String("section"), section); | - | ||||||||||||||||||||||||||||||
| 935 | } executed 20 times by 1 test: else {end of blockExecuted by:
| 20 | ||||||||||||||||||||||||||||||
| 936 | QQmlContext *creationContext = sectionCriteria->delegate()->creationContext(); | - | ||||||||||||||||||||||||||||||
| 937 | QQmlContext *context = new QQmlContext( | - | ||||||||||||||||||||||||||||||
| 938 | creationContext ? creationContext : qmlContext(q)); | - | ||||||||||||||||||||||||||||||
| 939 | context->setContextProperty(QLatin1String("section"), section); | - | ||||||||||||||||||||||||||||||
| 940 | QObject *nobj = sectionCriteria->delegate()->beginCreate(context); | - | ||||||||||||||||||||||||||||||
| 941 | if (nobj
| 0-182 | ||||||||||||||||||||||||||||||
| 942 | QQml_setParent_noEvent(context, nobj); | - | ||||||||||||||||||||||||||||||
| 943 | sectionItem = qobject_cast<QQuickItem *>(nobj); | - | ||||||||||||||||||||||||||||||
| 944 | if (!sectionItem
| 0-182 | ||||||||||||||||||||||||||||||
| 945 | delete nobj; | - | ||||||||||||||||||||||||||||||
| 946 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 947 | if (qFuzzyIsNull(sectionItem->z())
| 2-180 | ||||||||||||||||||||||||||||||
| 948 | sectionItem->setZ(2); executed 180 times by 3 tests: sectionItem->setZ(2);Executed by:
| 180 | ||||||||||||||||||||||||||||||
| 949 | QQml_setParent_noEvent(sectionItem, contentItem); | - | ||||||||||||||||||||||||||||||
| 950 | sectionItem->setParentItem(contentItem); | - | ||||||||||||||||||||||||||||||
| 951 | } executed 182 times by 3 tests: end of blockExecuted by:
| 182 | ||||||||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||||||||
| 953 | QQuickItemViewAttached *attached = static_cast<QQuickItemViewAttached*>(qmlAttachedPropertiesObject<QQuickListView>(sectionItem)); | - | ||||||||||||||||||||||||||||||
| 954 | attached->setView(q); | - | ||||||||||||||||||||||||||||||
| 955 | } executed 182 times by 3 tests: else {end of blockExecuted by:
| 182 | ||||||||||||||||||||||||||||||
| 956 | delete context; | - | ||||||||||||||||||||||||||||||
| 957 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 958 | sectionCriteria->delegate()->completeCreate(); | - | ||||||||||||||||||||||||||||||
| 959 | } executed 182 times by 3 tests: end of blockExecuted by:
| 182 | ||||||||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||||||||
| 961 | return executed 202 times by 3 tests: sectionItem;return sectionItem;Executed by:
executed 202 times by 3 tests: return sectionItem;Executed by:
| 202 | ||||||||||||||||||||||||||||||
| 962 | } | - | ||||||||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||||||||
| 964 | void QQuickListViewPrivate::releaseSectionItem(QQuickItem *item) | - | ||||||||||||||||||||||||||||||
| 965 | { | - | ||||||||||||||||||||||||||||||
| 966 | if (!item
| 40-8416 | ||||||||||||||||||||||||||||||
| 967 | return; executed 8416 times by 11 tests: return;Executed by:
| 8416 | ||||||||||||||||||||||||||||||
| 968 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 969 | do { | - | ||||||||||||||||||||||||||||||
| 970 | if (!sectionCache[i]
| 24-106 | ||||||||||||||||||||||||||||||
| 971 | sectionCache[i] = item; | - | ||||||||||||||||||||||||||||||
| 972 | sectionCache[i]->setVisible(false); | - | ||||||||||||||||||||||||||||||
| 973 | return; executed 24 times by 1 test: return;Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 974 | } | - | ||||||||||||||||||||||||||||||
| 975 | ++i; | - | ||||||||||||||||||||||||||||||
| 976 | } executed 106 times by 1 test: while (i < sectionCacheSizeend of blockExecuted by:
| 16-106 | ||||||||||||||||||||||||||||||
| 977 | delete item; | - | ||||||||||||||||||||||||||||||
| 978 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||||||||
| 981 | void QQuickListViewPrivate::releaseSectionItems() | - | ||||||||||||||||||||||||||||||
| 982 | { | - | ||||||||||||||||||||||||||||||
| 983 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 984 | FxListItemSG *listItem = static_cast<FxListItemSG *>(item); | - | ||||||||||||||||||||||||||||||
| 985 | if (listItem->section()
| 0-26 | ||||||||||||||||||||||||||||||
| 986 | qreal pos = listItem->position(); | - | ||||||||||||||||||||||||||||||
| 987 | releaseSectionItem(listItem->section()); | - | ||||||||||||||||||||||||||||||
| 988 | listItem->setSection(nullptr); | - | ||||||||||||||||||||||||||||||
| 989 | listItem->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 990 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||||||||
| 991 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||||||||
| 992 | for (int i = 0; i < sectionCacheSize
| 2-10 | ||||||||||||||||||||||||||||||
| 993 | delete sectionCache[i]; | - | ||||||||||||||||||||||||||||||
| 994 | sectionCache[i] = nullptr; | - | ||||||||||||||||||||||||||||||
| 995 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 996 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||||||||
| 998 | void QQuickListViewPrivate::updateInlineSection(FxListItemSG *listItem) | - | ||||||||||||||||||||||||||||||
| 999 | { | - | ||||||||||||||||||||||||||||||
| 1000 | if (!sectionCriteria
| 0-6418 | ||||||||||||||||||||||||||||||
| 1001 | return; executed 792 times by 2 tests: return;Executed by:
| 792 | ||||||||||||||||||||||||||||||
| 1002 | if (QString::compare(listItem->attached->m_prevSection, listItem->attached->m_section, Qt::CaseInsensitive)
| 938-4688 | ||||||||||||||||||||||||||||||
| 1003 | && (sectionCriteria->labelPositioning() & QQuickViewSection::InlineLabels
| 0-4688 | ||||||||||||||||||||||||||||||
| 1004 | || (listItem->index == 0
| 0 | ||||||||||||||||||||||||||||||
| 1005 | if (!listItem->section()
| 194-4494 | ||||||||||||||||||||||||||||||
| 1006 | qreal pos = listItem->position(); | - | ||||||||||||||||||||||||||||||
| 1007 | listItem->setSection(getSectionItem(listItem->attached->m_section)); | - | ||||||||||||||||||||||||||||||
| 1008 | listItem->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 1009 | } executed 194 times by 3 tests: else {end of blockExecuted by:
| 194 | ||||||||||||||||||||||||||||||
| 1010 | QQmlContext *context = QQmlEngine::contextForObject(listItem->section())->parentContext(); | - | ||||||||||||||||||||||||||||||
| 1011 | context->setContextProperty(QLatin1String("section"), listItem->attached->m_section); | - | ||||||||||||||||||||||||||||||
| 1012 | } executed 4494 times by 3 tests: end of blockExecuted by:
| 4494 | ||||||||||||||||||||||||||||||
| 1013 | } else if (listItem->section()
| 6-932 | ||||||||||||||||||||||||||||||
| 1014 | qreal pos = listItem->position(); | - | ||||||||||||||||||||||||||||||
| 1015 | releaseSectionItem(listItem->section()); | - | ||||||||||||||||||||||||||||||
| 1016 | listItem->setSection(nullptr); | - | ||||||||||||||||||||||||||||||
| 1017 | listItem->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 1018 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 1019 | } executed 5626 times by 3 tests: end of blockExecuted by:
| 5626 | ||||||||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||||||||
| 1021 | void QQuickListViewPrivate::updateStickySections() | - | ||||||||||||||||||||||||||||||
| 1022 | { | - | ||||||||||||||||||||||||||||||
| 1023 | if (!sectionCriteria
| 50-3014 | ||||||||||||||||||||||||||||||
| 1024 | || (!sectionCriteria->labelPositioning()
| 0-925 | ||||||||||||||||||||||||||||||
| 1025 | return; executed 3064 times by 6 tests: return;Executed by:
| 3064 | ||||||||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||||||||
| 1027 | bool isFlowReversed = isContentFlowReversed(); | - | ||||||||||||||||||||||||||||||
| 1028 | qreal viewPos = isFlowReversed
| 0-925 | ||||||||||||||||||||||||||||||
| 1029 | qreal startPos = hasStickyHeader()
| 0-925 | ||||||||||||||||||||||||||||||
| 1030 | qreal endPos = hasStickyFooter()
| 0-925 | ||||||||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||||||||
| 1032 | QQuickItem *sectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 1033 | QQuickItem *lastSectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 1034 | int index = 0; | - | ||||||||||||||||||||||||||||||
| 1035 | while (index < visibleItems.count()
| 925-8887 | ||||||||||||||||||||||||||||||
| 1036 | if (QQuickItem *section = static_cast<FxListItemSG *>(visibleItems.at(index))->section()
| 3872-5015 | ||||||||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||||||||
| 1039 | qreal sectionPos = orient == QQuickListView::Vertical
| 0-3872 | ||||||||||||||||||||||||||||||
| 1040 | qreal sectionSize = orient == QQuickListView::Vertical
| 0-3872 | ||||||||||||||||||||||||||||||
| 1041 | bool visTop = true; | - | ||||||||||||||||||||||||||||||
| 1042 | if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart
| 403-3469 | ||||||||||||||||||||||||||||||
| 1043 | visTop = isFlowReversed
executed 403 times by 1 test: visTop = isFlowReversed ? -sectionPos-sectionSize >= startPos : sectionPos >= startPos;Executed by:
| 0-403 | ||||||||||||||||||||||||||||||
| 1044 | bool visBot = true; | - | ||||||||||||||||||||||||||||||
| 1045 | if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd
| 383-3489 | ||||||||||||||||||||||||||||||
| 1046 | visBot = isFlowReversed
executed 383 times by 1 test: visBot = isFlowReversed ? -sectionPos <= endPos : sectionPos + sectionSize < endPos;Executed by:
| 0-383 | ||||||||||||||||||||||||||||||
| 1047 | section->setVisible(visBot && visTop); | - | ||||||||||||||||||||||||||||||
| 1048 | if (visTop
| 40-3832 | ||||||||||||||||||||||||||||||
| 1049 | sectionItem = section; executed 865 times by 3 tests: sectionItem = section;Executed by:
| 865 | ||||||||||||||||||||||||||||||
| 1050 | if (isFlowReversed
| 0-3872 | ||||||||||||||||||||||||||||||
| 1051 | if (-
| 0 | ||||||||||||||||||||||||||||||
| 1052 | lastSectionItem = section; never executed: lastSectionItem = section; | 0 | ||||||||||||||||||||||||||||||
| 1053 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1054 | if (sectionPos + sectionSize < endPos
| 660-3212 | ||||||||||||||||||||||||||||||
| 1055 | lastSectionItem = section; executed 3212 times by 3 tests: lastSectionItem = section;Executed by:
| 3212 | ||||||||||||||||||||||||||||||
| 1056 | } executed 3872 times by 3 tests: end of blockExecuted by:
| 3872 | ||||||||||||||||||||||||||||||
| 1057 | } | - | ||||||||||||||||||||||||||||||
| 1058 | ++index; | - | ||||||||||||||||||||||||||||||
| 1059 | } executed 8887 times by 3 tests: end of blockExecuted by:
| 8887 | ||||||||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||||||||
| 1062 | if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart
| 0-822 | ||||||||||||||||||||||||||||||
| 1063 | if (!currentSectionItem
| 4-86 | ||||||||||||||||||||||||||||||
| 1064 | currentSectionItem = getSectionItem(currentSection); | - | ||||||||||||||||||||||||||||||
| 1065 | } executed 4 times by 1 test: else if (QString::compare(currentStickySection, currentSection, Qt::CaseInsensitive)end of blockExecuted by:
| 4-76 | ||||||||||||||||||||||||||||||
| 1066 | QQmlContext *context = QQmlEngine::contextForObject(currentSectionItem)->parentContext(); | - | ||||||||||||||||||||||||||||||
| 1067 | context->setContextProperty(QLatin1String("section"), currentSection); | - | ||||||||||||||||||||||||||||||
| 1068 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||
| 1069 | currentStickySection = currentSection; | - | ||||||||||||||||||||||||||||||
| 1070 | if (!currentSectionItem
| 0-90 | ||||||||||||||||||||||||||||||
| 1071 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||||||||
| 1073 | qreal sectionSize = orient == QQuickListView::Vertical
| 0-90 | ||||||||||||||||||||||||||||||
| 1074 | bool atBeginning = orient == QQuickListView::Vertical
| 0-90 | ||||||||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||||||||
| 1076 | currentSectionItem->setVisible(!atBeginning && (!header || hasStickyHeader() || header->endPosition() < viewPos)); | - | ||||||||||||||||||||||||||||||
| 1077 | qreal pos = isFlowReversed
| 0-90 | ||||||||||||||||||||||||||||||
| 1078 | if (header
| 0-90 | ||||||||||||||||||||||||||||||
| 1079 | pos = isFlowReversed
never executed: pos = isFlowReversed ? qMin(-header->endPosition() - sectionSize, pos) : qMax(header->endPosition(), pos); | 0 | ||||||||||||||||||||||||||||||
| 1080 | if (sectionItem
| 0-90 | ||||||||||||||||||||||||||||||
| 1081 | qreal sectionPos = orient == QQuickListView::Vertical
| 0-90 | ||||||||||||||||||||||||||||||
| 1082 | pos = isFlowReversed
| 0-90 | ||||||||||||||||||||||||||||||
| 1083 | } executed 90 times by 1 test: end of blockExecuted by:
| 90 | ||||||||||||||||||||||||||||||
| 1084 | if (footer
| 0-90 | ||||||||||||||||||||||||||||||
| 1085 | pos = isFlowReversed
never executed: pos = isFlowReversed ? qMax(-footer->position(), pos) : qMin(footer->position() - sectionSize, pos); | 0 | ||||||||||||||||||||||||||||||
| 1086 | if (orient == QQuickListView::Vertical
| 0-90 | ||||||||||||||||||||||||||||||
| 1087 | currentSectionItem->setY(pos); executed 90 times by 1 test: currentSectionItem->setY(pos);Executed by:
| 90 | ||||||||||||||||||||||||||||||
| 1088 | else | - | ||||||||||||||||||||||||||||||
| 1089 | currentSectionItem->setX(pos); never executed: currentSectionItem->setX(pos); | 0 | ||||||||||||||||||||||||||||||
| 1090 | } else if (currentSectionItem
| 4-831 | ||||||||||||||||||||||||||||||
| 1091 | releaseSectionItem(currentSectionItem); | - | ||||||||||||||||||||||||||||||
| 1092 | currentSectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 1093 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 1094 | - | |||||||||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||||||||
| 1096 | if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd
| 0-826 | ||||||||||||||||||||||||||||||
| 1097 | if (!nextSectionItem
| 4-82 | ||||||||||||||||||||||||||||||
| 1098 | nextSectionItem = getSectionItem(nextSection); | - | ||||||||||||||||||||||||||||||
| 1099 | } executed 4 times by 1 test: else if (QString::compare(nextStickySection, nextSection, Qt::CaseInsensitive)end of blockExecuted by:
| 4-66 | ||||||||||||||||||||||||||||||
| 1100 | QQmlContext *context = QQmlEngine::contextForObject(nextSectionItem)->parentContext(); | - | ||||||||||||||||||||||||||||||
| 1101 | context->setContextProperty(QLatin1String("section"), nextSection); | - | ||||||||||||||||||||||||||||||
| 1102 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 1103 | nextStickySection = nextSection; | - | ||||||||||||||||||||||||||||||
| 1104 | if (!nextSectionItem
| 0-86 | ||||||||||||||||||||||||||||||
| 1105 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||||||||
| 1107 | qreal sectionSize = orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 1108 | nextSectionItem->setVisible(!nextSection.isEmpty()); | - | ||||||||||||||||||||||||||||||
| 1109 | qreal pos = isFlowReversed
| 0-86 | ||||||||||||||||||||||||||||||
| 1110 | if (footer
| 0-86 | ||||||||||||||||||||||||||||||
| 1111 | pos = isFlowReversed
never executed: pos = isFlowReversed ? qMax(-footer->position(), pos) : qMin(footer->position() - sectionSize, pos); | 0 | ||||||||||||||||||||||||||||||
| 1112 | if (lastSectionItem
| 0-86 | ||||||||||||||||||||||||||||||
| 1113 | qreal sectionPos = orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 1114 | pos = isFlowReversed
| 0-86 | ||||||||||||||||||||||||||||||
| 1115 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||||||||
| 1116 | if (header
| 0-86 | ||||||||||||||||||||||||||||||
| 1117 | pos = isFlowReversed
never executed: pos = isFlowReversed ? qMin(-header->endPosition() - sectionSize, pos) : qMax(header->endPosition(), pos); | 0 | ||||||||||||||||||||||||||||||
| 1118 | if (orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 1119 | nextSectionItem->setY(pos); executed 86 times by 1 test: nextSectionItem->setY(pos);Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 1120 | else | - | ||||||||||||||||||||||||||||||
| 1121 | nextSectionItem->setX(pos); never executed: nextSectionItem->setX(pos); | 0 | ||||||||||||||||||||||||||||||
| 1122 | } else if (nextSectionItem
| 4-835 | ||||||||||||||||||||||||||||||
| 1123 | releaseSectionItem(nextSectionItem); | - | ||||||||||||||||||||||||||||||
| 1124 | nextSectionItem = nullptr; | - | ||||||||||||||||||||||||||||||
| 1125 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 1126 | } executed 925 times by 3 tests: end of blockExecuted by:
| 925 | ||||||||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||||||||
| 1128 | void QQuickListViewPrivate::updateSections() | - | ||||||||||||||||||||||||||||||
| 1129 | { | - | ||||||||||||||||||||||||||||||
| 1130 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1131 | if (!q->isComponentComplete()
| 0-6944 | ||||||||||||||||||||||||||||||
| 1132 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||||||||
| 1134 | QQuickItemViewPrivate::updateSections(); | - | ||||||||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||||||||
| 1136 | if (sectionCriteria
| 15-6317 | ||||||||||||||||||||||||||||||
| 1137 | QString prevSection; | - | ||||||||||||||||||||||||||||||
| 1138 | if (visibleIndex > 0
| 4-556 | ||||||||||||||||||||||||||||||
| 1139 | prevSection = sectionAt(visibleIndex-1); executed 4 times by 1 test: prevSection = sectionAt(visibleIndex-1);Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1140 | QQuickListViewAttached *prevAtt = nullptr; | - | ||||||||||||||||||||||||||||||
| 1141 | int prevIdx = -1; | - | ||||||||||||||||||||||||||||||
| 1142 | int idx = -1; | - | ||||||||||||||||||||||||||||||
| 1143 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 1144 | QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(item->attached); | - | ||||||||||||||||||||||||||||||
| 1145 | attached->setPrevSection(prevSection); | - | ||||||||||||||||||||||||||||||
| 1146 | if (item->index != -1
| 38-6174 | ||||||||||||||||||||||||||||||
| 1147 | QString propValue = model->stringValue(item->index, sectionCriteria->property()); | - | ||||||||||||||||||||||||||||||
| 1148 | attached->setSection(sectionCriteria->sectionString(propValue)); | - | ||||||||||||||||||||||||||||||
| 1149 | idx = item->index; | - | ||||||||||||||||||||||||||||||
| 1150 | } executed 6174 times by 4 tests: end of blockExecuted by:
| 6174 | ||||||||||||||||||||||||||||||
| 1151 | updateInlineSection(static_cast<FxListItemSG*>(item)); | - | ||||||||||||||||||||||||||||||
| 1152 | if (prevAtt
| 560-5652 | ||||||||||||||||||||||||||||||
| 1153 | prevAtt->setNextSection(sectionAt(prevIdx+1)); executed 5652 times by 3 tests: prevAtt->setNextSection(sectionAt(prevIdx+1));Executed by:
| 5652 | ||||||||||||||||||||||||||||||
| 1154 | prevSection = attached->section(); | - | ||||||||||||||||||||||||||||||
| 1155 | prevAtt = attached; | - | ||||||||||||||||||||||||||||||
| 1156 | prevIdx = item->index; | - | ||||||||||||||||||||||||||||||
| 1157 | } executed 6212 times by 4 tests: end of blockExecuted by:
| 6212 | ||||||||||||||||||||||||||||||
| 1158 | if (prevAtt
| 0-560 | ||||||||||||||||||||||||||||||
| 1159 | if (idx > 0
| 4-556 | ||||||||||||||||||||||||||||||
| 1160 | prevAtt->setNextSection(sectionAt(idx+1)); executed 114 times by 2 tests: prevAtt->setNextSection(sectionAt(idx+1));Executed by:
| 114 | ||||||||||||||||||||||||||||||
| 1161 | else | - | ||||||||||||||||||||||||||||||
| 1162 | prevAtt->setNextSection(QString()); executed 446 times by 4 tests: prevAtt->setNextSection(QString());Executed by:
| 446 | ||||||||||||||||||||||||||||||
| 1163 | } | - | ||||||||||||||||||||||||||||||
| 1164 | } executed 560 times by 4 tests: end of blockExecuted by:
| 560 | ||||||||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||||||||
| 1166 | lastVisibleSection = QString(); | - | ||||||||||||||||||||||||||||||
| 1167 | } executed 6944 times by 11 tests: end of blockExecuted by:
| 6944 | ||||||||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||||||||
| 1169 | void QQuickListViewPrivate::updateCurrentSection() | - | ||||||||||||||||||||||||||||||
| 1170 | { | - | ||||||||||||||||||||||||||||||
| 1171 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1172 | if (!sectionCriteria
| 14-3014 | ||||||||||||||||||||||||||||||
| 1173 | if (!currentSection.isEmpty()
| 2-3026 | ||||||||||||||||||||||||||||||
| 1174 | currentSection.clear(); | - | ||||||||||||||||||||||||||||||
| 1175 | q->currentSectionChanged(); | - | ||||||||||||||||||||||||||||||
| 1176 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1177 | return; executed 3028 times by 6 tests: return;Executed by:
| 3028 | ||||||||||||||||||||||||||||||
| 1178 | } | - | ||||||||||||||||||||||||||||||
| 1179 | bool inlineSections = sectionCriteria->labelPositioning() & QQuickViewSection::InlineLabels; | - | ||||||||||||||||||||||||||||||
| 1180 | qreal viewPos = isContentFlowReversed()
| 0-986 | ||||||||||||||||||||||||||||||
| 1181 | qreal startPos = hasStickyHeader()
| 0-986 | ||||||||||||||||||||||||||||||
| 1182 | int index = 0; | - | ||||||||||||||||||||||||||||||
| 1183 | int modelIndex = visibleIndex; | - | ||||||||||||||||||||||||||||||
| 1184 | while (index < visibleItems.count()
| 57-1380 | ||||||||||||||||||||||||||||||
| 1185 | FxViewItem *item = visibleItems.at(index); | - | ||||||||||||||||||||||||||||||
| 1186 | if (item->endPosition() > startPos
| 451-929 | ||||||||||||||||||||||||||||||
| 1187 | break; executed 929 times by 4 tests: break;Executed by:
| 929 | ||||||||||||||||||||||||||||||
| 1188 | if (item->index != -1
| 0-451 | ||||||||||||||||||||||||||||||
| 1189 | modelIndex = item->index; executed 451 times by 1 test: modelIndex = item->index;Executed by:
| 451 | ||||||||||||||||||||||||||||||
| 1190 | ++index; | - | ||||||||||||||||||||||||||||||
| 1191 | } executed 451 times by 1 test: end of blockExecuted by:
| 451 | ||||||||||||||||||||||||||||||
| 1192 | - | |||||||||||||||||||||||||||||||
| 1193 | QString newSection = currentSection; | - | ||||||||||||||||||||||||||||||
| 1194 | if (index < visibleItems.count()
| 57-929 | ||||||||||||||||||||||||||||||
| 1195 | newSection = visibleItems.at(index)->attached->section(); executed 929 times by 4 tests: newSection = visibleItems.at(index)->attached->section();Executed by:
| 929 | ||||||||||||||||||||||||||||||
| 1196 | else | - | ||||||||||||||||||||||||||||||
| 1197 | newSection = (*visibleItems.constBegin())->attached->section(); executed 57 times by 1 test: newSection = (*visibleItems.constBegin())->attached->section();Executed by:
| 57 | ||||||||||||||||||||||||||||||
| 1198 | if (newSection != currentSection
| 142-844 | ||||||||||||||||||||||||||||||
| 1199 | currentSection = newSection; | - | ||||||||||||||||||||||||||||||
| 1200 | updateStickySections(); | - | ||||||||||||||||||||||||||||||
| 1201 | q->currentSectionChanged(); | - | ||||||||||||||||||||||||||||||
| 1202 | } executed 142 times by 4 tests: end of blockExecuted by:
| 142 | ||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||
| 1204 | if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd
| 69-917 | ||||||||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||
| 1209 | QString lastSection = currentSection; | - | ||||||||||||||||||||||||||||||
| 1210 | qreal endPos = hasStickyFooter()
| 0-69 | ||||||||||||||||||||||||||||||
| 1211 | if (nextSectionItem
| 0-54 | ||||||||||||||||||||||||||||||
| 1212 | endPos -= orient == QQuickListView::Vertical
never executed: endPos -= orient == QQuickListView::Vertical ? nextSectionItem->height() : nextSectionItem->width(); | 0 | ||||||||||||||||||||||||||||||
| 1213 | while (index < visibleItems.count()
| 4-994 | ||||||||||||||||||||||||||||||
| 1214 | FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(index)); | - | ||||||||||||||||||||||||||||||
| 1215 | if (listItem->itemPosition() >= endPos
| 65-929 | ||||||||||||||||||||||||||||||
| 1216 | break; executed 65 times by 1 test: break;Executed by:
| 65 | ||||||||||||||||||||||||||||||
| 1217 | if (listItem->index != -1
| 193-736 | ||||||||||||||||||||||||||||||
| 1218 | modelIndex = listItem->index; executed 736 times by 1 test: modelIndex = listItem->index;Executed by:
| 736 | ||||||||||||||||||||||||||||||
| 1219 | lastSection = listItem->attached->section(); | - | ||||||||||||||||||||||||||||||
| 1220 | ++index; | - | ||||||||||||||||||||||||||||||
| 1221 | } executed 929 times by 1 test: end of blockExecuted by:
| 929 | ||||||||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||||||||
| 1223 | if (lastVisibleSection != lastSection
| 22-47 | ||||||||||||||||||||||||||||||
| 1224 | nextSection = QString(); | - | ||||||||||||||||||||||||||||||
| 1225 | lastVisibleSection = lastSection; | - | ||||||||||||||||||||||||||||||
| 1226 | for (int i = modelIndex; i < itemCount
| 13-104 | ||||||||||||||||||||||||||||||
| 1227 | QString section = sectionAt(i); | - | ||||||||||||||||||||||||||||||
| 1228 | if (section != lastSection
| 34-70 | ||||||||||||||||||||||||||||||
| 1229 | nextSection = section; | - | ||||||||||||||||||||||||||||||
| 1230 | updateStickySections(); | - | ||||||||||||||||||||||||||||||
| 1231 | break; executed 34 times by 1 test: break;Executed by:
| 34 | ||||||||||||||||||||||||||||||
| 1232 | } | - | ||||||||||||||||||||||||||||||
| 1233 | } executed 70 times by 1 test: end of blockExecuted by:
| 70 | ||||||||||||||||||||||||||||||
| 1234 | } executed 47 times by 1 test: end of blockExecuted by:
| 47 | ||||||||||||||||||||||||||||||
| 1235 | } executed 69 times by 1 test: end of blockExecuted by:
| 69 | ||||||||||||||||||||||||||||||
| 1236 | } executed 986 times by 4 tests: end of blockExecuted by:
| 986 | ||||||||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||||||||
| 1238 | void QQuickListViewPrivate::initializeCurrentItem() | - | ||||||||||||||||||||||||||||||
| 1239 | { | - | ||||||||||||||||||||||||||||||
| 1240 | QQuickItemViewPrivate::initializeCurrentItem(); | - | ||||||||||||||||||||||||||||||
| 1241 | - | |||||||||||||||||||||||||||||||
| 1242 | if (currentItem
| 0-3584 | ||||||||||||||||||||||||||||||
| 1243 | FxListItemSG *listItem = static_cast<FxListItemSG *>(currentItem); | - | ||||||||||||||||||||||||||||||
| 1244 | - | |||||||||||||||||||||||||||||||
| 1245 | - | |||||||||||||||||||||||||||||||
| 1246 | FxViewItem *actualItem = visibleItem(currentIndex); | - | ||||||||||||||||||||||||||||||
| 1247 | if (!actualItem
| 167-3417 | ||||||||||||||||||||||||||||||
| 1248 | if (currentIndex == visibleIndex - 1
| 0-167 | ||||||||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||||||||
| 1250 | listItem->setPosition(visibleItems.constFirst()->position() - currentItem->size() - spacing); | - | ||||||||||||||||||||||||||||||
| 1251 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||||||||
| 1254 | listItem->setPosition(positionAt(currentIndex)); | - | ||||||||||||||||||||||||||||||
| 1255 | } executed 167 times by 2 tests: end of blockExecuted by:
| 167 | ||||||||||||||||||||||||||||||
| 1256 | } | - | ||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||
| 1258 | if (visibleItems.isEmpty()
| 50-3534 | ||||||||||||||||||||||||||||||
| 1259 | averageSize = listItem->size(); executed 50 times by 1 test: averageSize = listItem->size();Executed by:
| 50 | ||||||||||||||||||||||||||||||
| 1260 | } executed 3584 times by 10 tests: end of blockExecuted by:
| 3584 | ||||||||||||||||||||||||||||||
| 1261 | } executed 3584 times by 10 tests: end of blockExecuted by:
| 3584 | ||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||
| 1263 | void QQuickListViewPrivate::updateAverage() | - | ||||||||||||||||||||||||||||||
| 1264 | { | - | ||||||||||||||||||||||||||||||
| 1265 | if (!visibleItems.count()
| 0-5566 | ||||||||||||||||||||||||||||||
| 1266 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1267 | qreal sum = 0.0; | - | ||||||||||||||||||||||||||||||
| 1268 | for (FxViewItem *item : qAsConst(visibleItems)) | - | ||||||||||||||||||||||||||||||
| 1269 | sum += item->size(); executed 70254 times by 10 tests: sum += item->size();Executed by:
| 70254 | ||||||||||||||||||||||||||||||
| 1270 | averageSize = qRound(sum / visibleItems.count()); | - | ||||||||||||||||||||||||||||||
| 1271 | } executed 5566 times by 10 tests: end of blockExecuted by:
| 5566 | ||||||||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||||||||
| 1273 | qreal QQuickListViewPrivate::headerSize() const | - | ||||||||||||||||||||||||||||||
| 1274 | { | - | ||||||||||||||||||||||||||||||
| 1275 | return executed 42252 times by 11 tests: header ? header->size() : 0.0;return header ? header->size() : 0.0;Executed by:
executed 42252 times by 11 tests: return header ? header->size() : 0.0;Executed by:
| 42252 | ||||||||||||||||||||||||||||||
| 1276 | } | - | ||||||||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||||||||
| 1278 | qreal QQuickListViewPrivate::footerSize() const | - | ||||||||||||||||||||||||||||||
| 1279 | { | - | ||||||||||||||||||||||||||||||
| 1280 | return executed 33805 times by 11 tests: footer ? footer->size() : 0.0;return footer ? footer->size() : 0.0;Executed by:
executed 33805 times by 11 tests: return footer ? footer->size() : 0.0;Executed by:
| 33805 | ||||||||||||||||||||||||||||||
| 1281 | } | - | ||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||
| 1283 | bool QQuickListViewPrivate::showHeaderForIndex(int index) const | - | ||||||||||||||||||||||||||||||
| 1284 | { | - | ||||||||||||||||||||||||||||||
| 1285 | return executed 6526 times by 10 tests: index == 0;return index == 0;Executed by:
executed 6526 times by 10 tests: return index == 0;Executed by:
| 6526 | ||||||||||||||||||||||||||||||
| 1286 | } | - | ||||||||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||||||||
| 1288 | bool QQuickListViewPrivate::showFooterForIndex(int index) const | - | ||||||||||||||||||||||||||||||
| 1289 | { | - | ||||||||||||||||||||||||||||||
| 1290 | return executed 2661 times by 3 tests: model && index == model->count()-1;return model && index == model->count()-1;Executed by:
executed 2661 times by 3 tests: return model && index == model->count()-1;Executed by:
| 2661 | ||||||||||||||||||||||||||||||
| 1291 | } | - | ||||||||||||||||||||||||||||||
| 1292 | - | |||||||||||||||||||||||||||||||
| 1293 | void QQuickListViewPrivate::updateFooter() | - | ||||||||||||||||||||||||||||||
| 1294 | { | - | ||||||||||||||||||||||||||||||
| 1295 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1296 | bool created = false; | - | ||||||||||||||||||||||||||||||
| 1297 | if (!footer
| 1140-10385 | ||||||||||||||||||||||||||||||
| 1298 | QQuickItem *item = createComponentItem(footerComponent, 1.0); | - | ||||||||||||||||||||||||||||||
| 1299 | if (!item
| 144-10241 | ||||||||||||||||||||||||||||||
| 1300 | return; executed 10241 times by 11 tests: return;Executed by:
| 10241 | ||||||||||||||||||||||||||||||
| 1301 | footer = new FxListItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 1302 | footer->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 1303 | created = true; | - | ||||||||||||||||||||||||||||||
| 1304 | } executed 144 times by 2 tests: end of blockExecuted by:
| 144 | ||||||||||||||||||||||||||||||
| 1305 | - | |||||||||||||||||||||||||||||||
| 1306 | FxListItemSG *listItem = static_cast<FxListItemSG*>(footer); | - | ||||||||||||||||||||||||||||||
| 1307 | if (footerPositioning == QQuickListView::OverlayFooter
| 92-1192 | ||||||||||||||||||||||||||||||
| 1308 | listItem->setPosition(isContentFlowReversed() ? -position() - footerSize() : position() + size() - footerSize()); | - | ||||||||||||||||||||||||||||||
| 1309 | } executed 92 times by 1 test: else if (visibleItems.count()end of blockExecuted by:
| 92-922 | ||||||||||||||||||||||||||||||
| 1310 | if (footerPositioning == QQuickListView::PullBackFooter
| 238-684 | ||||||||||||||||||||||||||||||
| 1311 | qreal viewPos = isContentFlowReversed()
| 196-488 | ||||||||||||||||||||||||||||||
| 1312 | qreal clampedPos = qBound(originPosition() - footerSize() + size(), listItem->position(), lastPosition()); | - | ||||||||||||||||||||||||||||||
| 1313 | listItem->setPosition(qBound(viewPos - footerSize(), clampedPos, viewPos)); | - | ||||||||||||||||||||||||||||||
| 1314 | } executed 684 times by 1 test: else {end of blockExecuted by:
| 684 | ||||||||||||||||||||||||||||||
| 1315 | qreal endPos = lastPosition(); | - | ||||||||||||||||||||||||||||||
| 1316 | if (findLastVisibleIndex() == model->count()-1
| 50-188 | ||||||||||||||||||||||||||||||
| 1317 | listItem->setPosition(endPos); | - | ||||||||||||||||||||||||||||||
| 1318 | } executed 188 times by 2 tests: else {end of blockExecuted by:
| 188 | ||||||||||||||||||||||||||||||
| 1319 | qreal visiblePos = position() + q->height(); | - | ||||||||||||||||||||||||||||||
| 1320 | if (endPos <= visiblePos
| 0-50 | ||||||||||||||||||||||||||||||
| 1321 | listItem->setPosition(endPos); executed 22 times by 1 test: listItem->setPosition(endPos);Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 1322 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||||||||
| 1323 | } | - | ||||||||||||||||||||||||||||||
| 1324 | } else { | - | ||||||||||||||||||||||||||||||
| 1325 | listItem->setPosition(visiblePos); | - | ||||||||||||||||||||||||||||||
| 1326 | } executed 270 times by 2 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||||||||
| 1327 | - | |||||||||||||||||||||||||||||||
| 1328 | if (created
| 144-1140 | ||||||||||||||||||||||||||||||
| 1329 | q->footerItemChanged(); executed 144 times by 2 tests: q->footerItemChanged();Executed by:
| 144 | ||||||||||||||||||||||||||||||
| 1330 | } executed 1284 times by 2 tests: end of blockExecuted by:
| 1284 | ||||||||||||||||||||||||||||||
| 1331 | - | |||||||||||||||||||||||||||||||
| 1332 | void QQuickListViewPrivate::updateHeader() | - | ||||||||||||||||||||||||||||||
| 1333 | { | - | ||||||||||||||||||||||||||||||
| 1334 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1335 | bool created = false; | - | ||||||||||||||||||||||||||||||
| 1336 | if (!header
| 1079-10332 | ||||||||||||||||||||||||||||||
| 1337 | QQuickItem *item = createComponentItem(headerComponent, 1.0); | - | ||||||||||||||||||||||||||||||
| 1338 | if (!item
| 176-10156 | ||||||||||||||||||||||||||||||
| 1339 | return; executed 10156 times by 11 tests: return;Executed by:
| 10156 | ||||||||||||||||||||||||||||||
| 1340 | header = new FxListItemSG(item, q, true); | - | ||||||||||||||||||||||||||||||
| 1341 | header->trackGeometry(true); | - | ||||||||||||||||||||||||||||||
| 1342 | created = true; | - | ||||||||||||||||||||||||||||||
| 1343 | } executed 176 times by 2 tests: end of blockExecuted by:
| 176 | ||||||||||||||||||||||||||||||
| 1344 | - | |||||||||||||||||||||||||||||||
| 1345 | FxListItemSG *listItem = static_cast<FxListItemSG*>(header); | - | ||||||||||||||||||||||||||||||
| 1346 | if (headerPositioning == QQuickListView::OverlayHeader
| 128-1127 | ||||||||||||||||||||||||||||||
| 1347 | listItem->setPosition(isContentFlowReversed() ? -position() - size() : position()); | - | ||||||||||||||||||||||||||||||
| 1348 | } executed 128 times by 1 test: else if (visibleItems.count()end of blockExecuted by:
| 128-717 | ||||||||||||||||||||||||||||||
| 1349 | if (headerPositioning == QQuickListView::PullBackHeader
| 215-502 | ||||||||||||||||||||||||||||||
| 1350 | qreal viewPos = isContentFlowReversed()
| 124-378 | ||||||||||||||||||||||||||||||
| 1351 | qreal clampedPos = qBound(originPosition() - headerSize(), listItem->position(), lastPosition() - headerSize() - size()); | - | ||||||||||||||||||||||||||||||
| 1352 | listItem->setPosition(qBound(viewPos - headerSize(), clampedPos, viewPos)); | - | ||||||||||||||||||||||||||||||
| 1353 | } executed 502 times by 1 test: else {end of blockExecuted by:
| 502 | ||||||||||||||||||||||||||||||
| 1354 | qreal startPos = originPosition(); | - | ||||||||||||||||||||||||||||||
| 1355 | if (visibleIndex == 0
| 12-203 | ||||||||||||||||||||||||||||||
| 1356 | listItem->setPosition(startPos - headerSize()); | - | ||||||||||||||||||||||||||||||
| 1357 | } executed 203 times by 2 tests: else {end of blockExecuted by:
| 203 | ||||||||||||||||||||||||||||||
| 1358 | if (position() <= startPos
| 0-12 | ||||||||||||||||||||||||||||||
| 1359 | listItem->setPosition(startPos - headerSize()); executed 2 times by 1 test: listItem->setPosition(startPos - headerSize());Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1360 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 1361 | } | - | ||||||||||||||||||||||||||||||
| 1362 | } else { | - | ||||||||||||||||||||||||||||||
| 1363 | listItem->setPosition(-headerSize()); | - | ||||||||||||||||||||||||||||||
| 1364 | } executed 410 times by 2 tests: end of blockExecuted by:
| 410 | ||||||||||||||||||||||||||||||
| 1365 | - | |||||||||||||||||||||||||||||||
| 1366 | if (created
| 176-1079 | ||||||||||||||||||||||||||||||
| 1367 | q->headerItemChanged(); executed 176 times by 2 tests: q->headerItemChanged();Executed by:
| 176 | ||||||||||||||||||||||||||||||
| 1368 | } executed 1255 times by 2 tests: end of blockExecuted by:
| 1255 | ||||||||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||||||||
| 1370 | bool QQuickListViewPrivate::hasStickyHeader() const | - | ||||||||||||||||||||||||||||||
| 1371 | { | - | ||||||||||||||||||||||||||||||
| 1372 | return executed 12278 times by 5 tests: header && headerPositioning != QQuickListView::InlineHeader;return header && headerPositioning != QQuickListView::InlineHeader;Executed by:
executed 12278 times by 5 tests: return header && headerPositioning != QQuickListView::InlineHeader;Executed by:
| 12278 | ||||||||||||||||||||||||||||||
| 1373 | } | - | ||||||||||||||||||||||||||||||
| 1374 | - | |||||||||||||||||||||||||||||||
| 1375 | bool QQuickListViewPrivate::hasStickyFooter() const | - | ||||||||||||||||||||||||||||||
| 1376 | { | - | ||||||||||||||||||||||||||||||
| 1377 | return executed 11361 times by 5 tests: footer && footerPositioning != QQuickListView::InlineFooter;return footer && footerPositioning != QQuickListView::InlineFooter;Executed by:
executed 11361 times by 5 tests: return footer && footerPositioning != QQuickListView::InlineFooter;Executed by:
| 11361 | ||||||||||||||||||||||||||||||
| 1378 | } | - | ||||||||||||||||||||||||||||||
| 1379 | - | |||||||||||||||||||||||||||||||
| 1380 | void QQuickListViewPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, | - | ||||||||||||||||||||||||||||||
| 1381 | const QRectF &oldGeometry) | - | ||||||||||||||||||||||||||||||
| 1382 | { | - | ||||||||||||||||||||||||||||||
| 1383 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 1384 | - | |||||||||||||||||||||||||||||||
| 1385 | QQuickItemViewPrivate::itemGeometryChanged(item, change, oldGeometry); | - | ||||||||||||||||||||||||||||||
| 1386 | if (!q->isComponentComplete()
| 3412-80231 | ||||||||||||||||||||||||||||||
| 1387 | return; executed 3412 times by 8 tests: return;Executed by:
| 3412 | ||||||||||||||||||||||||||||||
| 1388 | - | |||||||||||||||||||||||||||||||
| 1389 | if (currentItem
| 2939-55640 | ||||||||||||||||||||||||||||||
| 1390 | const bool contentFlowReversed = isContentFlowReversed(); | - | ||||||||||||||||||||||||||||||
| 1391 | const qreal pos = position(); | - | ||||||||||||||||||||||||||||||
| 1392 | const qreal sz = size(); | - | ||||||||||||||||||||||||||||||
| 1393 | const qreal from = contentFlowReversed
| 74-2865 | ||||||||||||||||||||||||||||||
| 1394 | const qreal to = contentFlowReversed
| 74-2865 | ||||||||||||||||||||||||||||||
| 1395 | QQuickItemPrivate::get(currentItem->item)->setCulled(currentItem->endPosition() < from || currentItem->position() > to); | - | ||||||||||||||||||||||||||||||
| 1396 | } executed 2939 times by 4 tests: end of blockExecuted by:
| 2939 | ||||||||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||||||||
| 1398 | if (item != contentItem
| 7803-63911 | ||||||||||||||||||||||||||||||
| 1399 | if ((orient == QQuickListView::Vertical
| 2578-53530 | ||||||||||||||||||||||||||||||
| 1400 | || (orient == QQuickListView::Horizontal
| 222-50665 | ||||||||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||||||||
| 1402 | - | |||||||||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||||||||
| 1404 | if (visibleItems.count()
| 30-3057 | ||||||||||||||||||||||||||||||
| 1405 | FxListItemSG *listItem = static_cast<FxListItemSG*>(visibleItems.constFirst()); | - | ||||||||||||||||||||||||||||||
| 1406 | if (listItem->transitionScheduledOrRunning()
| 16-110 | ||||||||||||||||||||||||||||||
| 1407 | return; executed 16 times by 1 test: return;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 1408 | if (orient == QQuickListView::Vertical
| 4-106 | ||||||||||||||||||||||||||||||
| 1409 | const qreal oldItemEndPosition = verticalLayoutDirection == QQuickItemView::BottomToTop
| 0-106 | ||||||||||||||||||||||||||||||
| 1410 | const qreal heightDiff = item->height() - oldGeometry.height(); | - | ||||||||||||||||||||||||||||||
| 1411 | if (verticalLayoutDirection == QQuickListView::TopToBottom
| 0-106 | ||||||||||||||||||||||||||||||
| 1412 | listItem->setPosition(listItem->position() - heightDiff, true); executed 8 times by 1 test: listItem->setPosition(listItem->position() - heightDiff, true);Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 1413 | else if (verticalLayoutDirection == QQuickListView::BottomToTop
| 0-98 | ||||||||||||||||||||||||||||||
| 1414 | listItem->setPosition(listItem->position() + heightDiff, true); never executed: listItem->setPosition(listItem->position() + heightDiff, true); | 0 | ||||||||||||||||||||||||||||||
| 1415 | } executed 106 times by 1 test: else {end of blockExecuted by:
| 106 | ||||||||||||||||||||||||||||||
| 1416 | const qreal oldItemEndPosition = q->effectiveLayoutDirection() == Qt::RightToLeft
| 0-4 | ||||||||||||||||||||||||||||||
| 1417 | const qreal widthDiff = item->width() - oldGeometry.width(); | - | ||||||||||||||||||||||||||||||
| 1418 | if (q->effectiveLayoutDirection() == Qt::LeftToRight
| 0-4 | ||||||||||||||||||||||||||||||
| 1419 | listItem->setPosition(listItem->position() - widthDiff, true); executed 4 times by 1 test: listItem->setPosition(listItem->position() - widthDiff, true);Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1420 | else if (q->effectiveLayoutDirection() == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||||||||
| 1421 | listItem->setPosition(listItem->position() + widthDiff, true); never executed: listItem->setPosition(listItem->position() + widthDiff, true); | 0 | ||||||||||||||||||||||||||||||
| 1422 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 1423 | } | - | ||||||||||||||||||||||||||||||
| 1424 | forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 1425 | } executed 3071 times by 10 tests: end of blockExecuted by:
| 3071 | ||||||||||||||||||||||||||||||
| 1426 | } executed 56092 times by 10 tests: end of blockExecuted by:
| 56092 | ||||||||||||||||||||||||||||||
| 1427 | } executed 80215 times by 10 tests: end of blockExecuted by:
| 80215 | ||||||||||||||||||||||||||||||
| 1428 | - | |||||||||||||||||||||||||||||||
| 1429 | void QQuickListViewPrivate::fixupPosition() | - | ||||||||||||||||||||||||||||||
| 1430 | { | - | ||||||||||||||||||||||||||||||
| 1431 | if (orient == QQuickListView::Vertical
| 686-5117 | ||||||||||||||||||||||||||||||
| 1432 | fixupY(); executed 5117 times by 10 tests: fixupY();Executed by:
| 5117 | ||||||||||||||||||||||||||||||
| 1433 | else | - | ||||||||||||||||||||||||||||||
| 1434 | fixupX(); executed 686 times by 2 tests: fixupX();Executed by:
| 686 | ||||||||||||||||||||||||||||||
| 1435 | } | - | ||||||||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||||||||
| 1437 | void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) | - | ||||||||||||||||||||||||||||||
| 1438 | { | - | ||||||||||||||||||||||||||||||
| 1439 | if (orient == QQuickListView::Horizontal
| 190-11081 | ||||||||||||||||||||||||||||||
| 1440 | if (flickableDirection != QQuickFlickable::HorizontalFlick
| 0-190 | ||||||||||||||||||||||||||||||
| 1441 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); never executed: QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | 0 | ||||||||||||||||||||||||||||||
| 1442 | return; executed 190 times by 2 tests: return;Executed by:
| 190 | ||||||||||||||||||||||||||||||
| 1443 | } else if (orient == QQuickListView::Vertical
| 352-11081 | ||||||||||||||||||||||||||||||
| 1444 | if (flickableDirection != QQuickFlickable::VerticalFlick
| 0-352 | ||||||||||||||||||||||||||||||
| 1445 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); never executed: QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | 0 | ||||||||||||||||||||||||||||||
| 1446 | return; executed 352 times by 4 tests: return;Executed by:
| 352 | ||||||||||||||||||||||||||||||
| 1447 | } | - | ||||||||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||||||||
| 1449 | correctFlick = false; | - | ||||||||||||||||||||||||||||||
| 1450 | fixupMode = moveReason == Mouse
| 317-11696 | ||||||||||||||||||||||||||||||
| 1451 | bool strictHighlightRange = haveHighlightRange
| 48-11428 | ||||||||||||||||||||||||||||||
| 1452 | - | |||||||||||||||||||||||||||||||
| 1453 | qreal viewPos = isContentFlowReversed()
| 1146-10867 | ||||||||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||||||||
| 1455 | if (snapMode != QQuickListView::NoSnap
| 78-11068 | ||||||||||||||||||||||||||||||
| 1456 | qreal tempPosition = isContentFlowReversed()
| 330-537 | ||||||||||||||||||||||||||||||
| 1457 | if (snapMode == QQuickListView::SnapOneItem
| 121-546 | ||||||||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||||||||
| 1459 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 1460 | qreal bias = 0; | - | ||||||||||||||||||||||||||||||
| 1461 | if (data.velocity > 0
| 0-61 | ||||||||||||||||||||||||||||||
| 1462 | bias = averageSize/2; executed 12 times by 1 test: bias = averageSize/2;Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 1463 | else if (data.velocity < 0
| 0-60 | ||||||||||||||||||||||||||||||
| 1464 | bias = -averageSize/2; executed 12 times by 1 test: bias = -averageSize/2;Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 1465 | if (isContentFlowReversed()
| 48-73 | ||||||||||||||||||||||||||||||
| 1466 | bias = -bias; executed 48 times by 1 test: bias = -bias;Executed by:
| 48 | ||||||||||||||||||||||||||||||
| 1467 | tempPosition -= bias; | - | ||||||||||||||||||||||||||||||
| 1468 | } executed 121 times by 1 test: end of blockExecuted by:
| 121 | ||||||||||||||||||||||||||||||
| 1469 | FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart); | - | ||||||||||||||||||||||||||||||
| 1470 | if (strictHighlightRange
| 1-476 | ||||||||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||||||||
| 1472 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 1473 | topItem = currentItem; | - | ||||||||||||||||||||||||||||||
| 1474 | } executed 27 times by 1 test: end of blockExecuted by:
| 27 | ||||||||||||||||||||||||||||||
| 1475 | FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd); | - | ||||||||||||||||||||||||||||||
| 1476 | if (strictHighlightRange
| 19-476 | ||||||||||||||||||||||||||||||
| 1477 | - | |||||||||||||||||||||||||||||||
| 1478 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 1479 | bottomItem = currentItem; | - | ||||||||||||||||||||||||||||||
| 1480 | } executed 103 times by 1 test: end of blockExecuted by:
| 103 | ||||||||||||||||||||||||||||||
| 1481 | qreal pos; | - | ||||||||||||||||||||||||||||||
| 1482 | bool isInBounds = -
| 71-633 | ||||||||||||||||||||||||||||||
| 1483 | if (topItem
| 54-461 | ||||||||||||||||||||||||||||||
| 1484 | if (topItem->index == 0
| 0-227 | ||||||||||||||||||||||||||||||
| 1485 | pos = isContentFlowReversed()
| 0 | ||||||||||||||||||||||||||||||
| 1486 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1487 | if (isContentFlowReversed()
| 168-239 | ||||||||||||||||||||||||||||||
| 1488 | pos = qMax(qMin(-topItem->position() + highlightRangeStart - size(), -maxExtent), -minExtent); executed 168 times by 1 test: pos = qMax(qMin(-topItem->position() + highlightRangeStart - size(), -maxExtent), -minExtent);Executed by:
| 168 | ||||||||||||||||||||||||||||||
| 1489 | else | - | ||||||||||||||||||||||||||||||
| 1490 | pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent); executed 239 times by 2 tests: pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent);Executed by:
| 239 | ||||||||||||||||||||||||||||||
| 1491 | } | - | ||||||||||||||||||||||||||||||
| 1492 | } else if (bottomItem
| 0-398 | ||||||||||||||||||||||||||||||
| 1493 | if (isContentFlowReversed()
| 0 | ||||||||||||||||||||||||||||||
| 1494 | pos = qMax(qMin(-bottomItem->position() + highlightRangeEnd - size(), -maxExtent), -minExtent); never executed: pos = qMax(qMin(-bottomItem->position() + highlightRangeEnd - size(), -maxExtent), -minExtent); | 0 | ||||||||||||||||||||||||||||||
| 1495 | else | - | ||||||||||||||||||||||||||||||
| 1496 | pos = qMax(qMin(bottomItem->position() - highlightRangeEnd, -maxExtent), -minExtent); never executed: pos = qMax(qMin(bottomItem->position() - highlightRangeEnd, -maxExtent), -minExtent); | 0 | ||||||||||||||||||||||||||||||
| 1497 | } else { | - | ||||||||||||||||||||||||||||||
| 1498 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 1499 | return; executed 460 times by 2 tests: return;Executed by:
| 460 | ||||||||||||||||||||||||||||||
| 1500 | } | - | ||||||||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||||||||
| 1502 | qreal dist = qAbs(data.move + pos); | - | ||||||||||||||||||||||||||||||
| 1503 | if (dist > 0
| 168-239 | ||||||||||||||||||||||||||||||
| 1504 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1505 | if (fixupMode != Immediate
| 94-145 | ||||||||||||||||||||||||||||||
| 1506 | timeline.move(data.move, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); | - | ||||||||||||||||||||||||||||||
| 1507 | data.fixingUp = true; | - | ||||||||||||||||||||||||||||||
| 1508 | } executed 145 times by 1 test: else {end of blockExecuted by:
| 145 | ||||||||||||||||||||||||||||||
| 1509 | timeline.set(data.move, -pos); | - | ||||||||||||||||||||||||||||||
| 1510 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 1511 | vTime = timeline.time(); | - | ||||||||||||||||||||||||||||||
| 1512 | } executed 239 times by 1 test: end of blockExecuted by:
| 239 | ||||||||||||||||||||||||||||||
| 1513 | } executed 407 times by 2 tests: else if (currentItemend of blockExecuted by:
| 2-6934 | ||||||||||||||||||||||||||||||
| 1514 | updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 1515 | qreal pos = static_cast<FxListItemSG*>(currentItem)->itemPosition(); | - | ||||||||||||||||||||||||||||||
| 1516 | if (viewPos < pos + static_cast<FxListItemSG*>(currentItem)->itemSize() - highlightRangeEnd
| 12-64 | ||||||||||||||||||||||||||||||
| 1517 | viewPos = pos + static_cast<FxListItemSG*>(currentItem)->itemSize() - highlightRangeEnd; executed 64 times by 2 tests: viewPos = pos + static_cast<FxListItemSG*>(currentItem)->itemSize() - highlightRangeEnd;Executed by:
| 64 | ||||||||||||||||||||||||||||||
| 1518 | if (viewPos > pos - highlightRangeStart
| 0-76 | ||||||||||||||||||||||||||||||
| 1519 | viewPos = pos - highlightRangeStart; executed 76 times by 2 tests: viewPos = pos - highlightRangeStart;Executed by:
| 76 | ||||||||||||||||||||||||||||||
| 1520 | if (isContentFlowReversed()
| 10-66 | ||||||||||||||||||||||||||||||
| 1521 | viewPos = -viewPos-size(); executed 10 times by 1 test: viewPos = -viewPos-size();Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||||||||
| 1523 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1524 | if (viewPos != position()
| 16-60 | ||||||||||||||||||||||||||||||
| 1525 | if (fixupMode != Immediate
| 2-14 | ||||||||||||||||||||||||||||||
| 1526 | timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); | - | ||||||||||||||||||||||||||||||
| 1527 | data.fixingUp = true; | - | ||||||||||||||||||||||||||||||
| 1528 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1529 | timeline.set(data.move, -viewPos); | - | ||||||||||||||||||||||||||||||
| 1530 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||||||||
| 1531 | } | - | ||||||||||||||||||||||||||||||
| 1532 | vTime = timeline.time(); | - | ||||||||||||||||||||||||||||||
| 1533 | } executed 76 times by 2 tests: else {end of blockExecuted by:
| 76 | ||||||||||||||||||||||||||||||
| 1534 | QQuickItemViewPrivate::fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 1535 | } executed 11070 times by 11 tests: end of blockExecuted by:
| 11070 | ||||||||||||||||||||||||||||||
| 1536 | data.inOvershoot = false; | - | ||||||||||||||||||||||||||||||
| 1537 | fixupMode = Normal; | - | ||||||||||||||||||||||||||||||
| 1538 | } executed 11553 times by 11 tests: end of blockExecuted by:
| 11553 | ||||||||||||||||||||||||||||||
| 1539 | - | |||||||||||||||||||||||||||||||
| 1540 | bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, | - | ||||||||||||||||||||||||||||||
| 1541 | QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) | - | ||||||||||||||||||||||||||||||
| 1542 | { | - | ||||||||||||||||||||||||||||||
| 1543 | data.fixingUp = false; | - | ||||||||||||||||||||||||||||||
| 1544 | moveReason = Mouse; | - | ||||||||||||||||||||||||||||||
| 1545 | if ((!haveHighlightRange
| 0-1097 | ||||||||||||||||||||||||||||||
| 1546 | correctFlick = true; | - | ||||||||||||||||||||||||||||||
| 1547 | return executed 51 times by 1 test: QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);return QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);Executed by:
executed 51 times by 1 test: return QQuickItemViewPrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);Executed by:
| 51 | ||||||||||||||||||||||||||||||
| 1548 | } | - | ||||||||||||||||||||||||||||||
| 1549 | qreal maxDistance = 0; | - | ||||||||||||||||||||||||||||||
| 1550 | qreal dataValue = isContentFlowReversed()
| 1000-1048 | ||||||||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||||||||
| 1553 | if (velocity > 0
| 1006-1042 | ||||||||||||||||||||||||||||||
| 1554 | if (data.move.value() < minExtent
| 14-992 | ||||||||||||||||||||||||||||||
| 1555 | if (snapMode == QQuickListView::SnapOneItem
| 48-780 | ||||||||||||||||||||||||||||||
| 1556 | - | |||||||||||||||||||||||||||||||
| 1557 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 1558 | qreal bias = dist < averageSize/2
| 0-48 | ||||||||||||||||||||||||||||||
| 1559 | if (isContentFlowReversed()
| 24 | ||||||||||||||||||||||||||||||
| 1560 | bias = -bias; executed 24 times by 1 test: bias = -bias;Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 1561 | data.flickTarget = -snapPosAt(-(dataValue - highlightRangeStart) - bias) + highlightRangeStart; | - | ||||||||||||||||||||||||||||||
| 1562 | maxDistance = qAbs(data.flickTarget - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 1563 | velocity = maxVelocity; | - | ||||||||||||||||||||||||||||||
| 1564 | } executed 48 times by 1 test: else {end of blockExecuted by:
| 48 | ||||||||||||||||||||||||||||||
| 1565 | maxDistance = qAbs(minExtent - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 1566 | } executed 944 times by 1 test: end of blockExecuted by:
| 944 | ||||||||||||||||||||||||||||||
| 1567 | } | - | ||||||||||||||||||||||||||||||
| 1568 | if (snapMode == QQuickListView::NoSnap
| 0-1002 | ||||||||||||||||||||||||||||||
| 1569 | data.flickTarget = minExtent; never executed: data.flickTarget = minExtent; | 0 | ||||||||||||||||||||||||||||||
| 1570 | } executed 1006 times by 1 test: else {end of blockExecuted by:
| 1006 | ||||||||||||||||||||||||||||||
| 1571 | if (data.move.value() > maxExtent
| 16-1026 | ||||||||||||||||||||||||||||||
| 1572 | if (snapMode == QQuickListView::SnapOneItem
| 48-811 | ||||||||||||||||||||||||||||||
| 1573 | - | |||||||||||||||||||||||||||||||
| 1574 | qreal dist = data.move.value() - data.pressPos; | - | ||||||||||||||||||||||||||||||
| 1575 | qreal bias = -
| 0-48 | ||||||||||||||||||||||||||||||
| 1576 | if (isContentFlowReversed()
| 24 | ||||||||||||||||||||||||||||||
| 1577 | bias = -bias; executed 24 times by 1 test: bias = -bias;Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 1578 | data.flickTarget = -snapPosAt(-(dataValue - highlightRangeStart) + bias) + highlightRangeStart; | - | ||||||||||||||||||||||||||||||
| 1579 | maxDistance = qAbs(data.flickTarget - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 1580 | velocity = -maxVelocity; | - | ||||||||||||||||||||||||||||||
| 1581 | } executed 48 times by 1 test: else {end of blockExecuted by:
| 48 | ||||||||||||||||||||||||||||||
| 1582 | maxDistance = qAbs(maxExtent - data.move.value()); | - | ||||||||||||||||||||||||||||||
| 1583 | } executed 978 times by 1 test: end of blockExecuted by:
| 978 | ||||||||||||||||||||||||||||||
| 1584 | } | - | ||||||||||||||||||||||||||||||
| 1585 | if (snapMode == QQuickListView::NoSnap
| 0-1038 | ||||||||||||||||||||||||||||||
| 1586 | data.flickTarget = maxExtent; never executed: data.flickTarget = maxExtent; | 0 | ||||||||||||||||||||||||||||||
| 1587 | } executed 1042 times by 1 test: end of blockExecuted by:
| 1042 | ||||||||||||||||||||||||||||||
| 1588 | bool overShoot = boundsBehavior & QQuickFlickable::OvershootBounds; | - | ||||||||||||||||||||||||||||||
| 1589 | if (maxDistance > 0
| 0-2018 | ||||||||||||||||||||||||||||||
| 1590 | - | |||||||||||||||||||||||||||||||
| 1591 | - | |||||||||||||||||||||||||||||||
| 1592 | - | |||||||||||||||||||||||||||||||
| 1593 | - | |||||||||||||||||||||||||||||||
| 1594 | qreal v = velocity; | - | ||||||||||||||||||||||||||||||
| 1595 | if (maxVelocity != -1
| 0-2048 | ||||||||||||||||||||||||||||||
| 1596 | if (v < 0
| 1-2 | ||||||||||||||||||||||||||||||
| 1597 | v = -maxVelocity; executed 2 times by 1 test: v = -maxVelocity;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1598 | else | - | ||||||||||||||||||||||||||||||
| 1599 | v = maxVelocity; executed 1 time by 1 test: v = maxVelocity;Executed by:
| 1 | ||||||||||||||||||||||||||||||
| 1600 | } | - | ||||||||||||||||||||||||||||||
| 1601 | if (!hData.flicking
| 210-1113 | ||||||||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||||||||
| 1603 | qreal accel = deceleration; | - | ||||||||||||||||||||||||||||||
| 1604 | qreal v2 = v * v; | - | ||||||||||||||||||||||||||||||
| 1605 | overshootDist = 0.0; | - | ||||||||||||||||||||||||||||||
| 1606 | - | |||||||||||||||||||||||||||||||
| 1607 | qreal dist = v2 / (accel * 2.0) + averageSize/4; | - | ||||||||||||||||||||||||||||||
| 1608 | if (maxDistance > 0
| 30-180 | ||||||||||||||||||||||||||||||
| 1609 | dist = qMin(dist, maxDistance); executed 180 times by 1 test: dist = qMin(dist, maxDistance);Executed by:
| 180 | ||||||||||||||||||||||||||||||
| 1610 | if (v > 0
| 102-108 | ||||||||||||||||||||||||||||||
| 1611 | dist = -dist; executed 102 times by 1 test: dist = -dist;Executed by:
| 102 | ||||||||||||||||||||||||||||||
| 1612 | if ((maxDistance > 0.0
| 30-180 | ||||||||||||||||||||||||||||||
| 1613 | if (snapMode != QQuickListView::SnapOneItem
| 66-98 | ||||||||||||||||||||||||||||||
| 1614 | qreal distTemp = isContentFlowReversed()
| 32-34 | ||||||||||||||||||||||||||||||
| 1615 | data.flickTarget = -snapPosAt(-(dataValue - highlightRangeStart) + distTemp) + highlightRangeStart; | - | ||||||||||||||||||||||||||||||
| 1616 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||||||||||||||||||||
| 1617 | data.flickTarget = isContentFlowReversed()
| 80-84 | ||||||||||||||||||||||||||||||
| 1618 | if (overShoot
| 0-164 | ||||||||||||||||||||||||||||||
| 1619 | if (data.flickTarget > minExtent
| 10-154 | ||||||||||||||||||||||||||||||
| 1620 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1621 | data.flickTarget += overshootDist; | - | ||||||||||||||||||||||||||||||
| 1622 | } executed 10 times by 1 test: else if (data.flickTarget < maxExtentend of blockExecuted by:
| 8-146 | ||||||||||||||||||||||||||||||
| 1623 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1624 | data.flickTarget -= overshootDist; | - | ||||||||||||||||||||||||||||||
| 1625 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 1626 | } executed 164 times by 1 test: end of blockExecuted by:
| 164 | ||||||||||||||||||||||||||||||
| 1627 | qreal adjDist = -data.flickTarget + data.move.value(); | - | ||||||||||||||||||||||||||||||
| 1628 | if (qAbs(adjDist) > qAbs(dist)
| 15-149 | ||||||||||||||||||||||||||||||
| 1629 | - | |||||||||||||||||||||||||||||||
| 1630 | qreal adjv2 = accel * 2.0f * qAbs(adjDist); | - | ||||||||||||||||||||||||||||||
| 1631 | if (adjv2 > v2
| 7-8 | ||||||||||||||||||||||||||||||
| 1632 | v2 = adjv2; | - | ||||||||||||||||||||||||||||||
| 1633 | v = qSqrt(v2); | - | ||||||||||||||||||||||||||||||
| 1634 | if (dist > 0
| 2-5 | ||||||||||||||||||||||||||||||
| 1635 | v = -v; executed 2 times by 1 test: v = -v;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1636 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||
| 1637 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||||||||
| 1638 | dist = adjDist; | - | ||||||||||||||||||||||||||||||
| 1639 | accel = v2 / (2.0f * qAbs(dist)); | - | ||||||||||||||||||||||||||||||
| 1640 | } executed 164 times by 1 test: else if (overShootend of blockExecuted by:
| 0-164 | ||||||||||||||||||||||||||||||
| 1641 | data.flickTarget = data.move.value() - dist; | - | ||||||||||||||||||||||||||||||
| 1642 | if (data.flickTarget > minExtent
| 12-34 | ||||||||||||||||||||||||||||||
| 1643 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1644 | data.flickTarget += overshootDist; | - | ||||||||||||||||||||||||||||||
| 1645 | } executed 12 times by 1 test: else if (data.flickTarget < maxExtentend of blockExecuted by:
| 12-18 | ||||||||||||||||||||||||||||||
| 1646 | overshootDist = overShootDistance(vSize); | - | ||||||||||||||||||||||||||||||
| 1647 | data.flickTarget -= overshootDist; | - | ||||||||||||||||||||||||||||||
| 1648 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||||||||
| 1649 | } executed 46 times by 1 test: end of blockExecuted by:
| 46 | ||||||||||||||||||||||||||||||
| 1650 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1651 | timeline.accel(data.move, v, accel, maxDistance + overshootDist); | - | ||||||||||||||||||||||||||||||
| 1652 | timeline.callback(QQuickTimeLineCallback(&data.move, fixupCallback, this)); | - | ||||||||||||||||||||||||||||||
| 1653 | correctFlick = true; | - | ||||||||||||||||||||||||||||||
| 1654 | return executed 210 times by 1 test: true;return true;Executed by:
executed 210 times by 1 test: return true;Executed by:
| 210 | ||||||||||||||||||||||||||||||
| 1655 | } else { | - | ||||||||||||||||||||||||||||||
| 1656 | - | |||||||||||||||||||||||||||||||
| 1657 | qreal newtarget = data.flickTarget; | - | ||||||||||||||||||||||||||||||
| 1658 | if (snapMode != QQuickListView::NoSnap
| 0-1838 | ||||||||||||||||||||||||||||||
| 1659 | qreal tempFlickTarget = isContentFlowReversed()
| 904-934 | ||||||||||||||||||||||||||||||
| 1660 | newtarget = -snapPosAt(-(tempFlickTarget - highlightRangeStart)) + highlightRangeStart; | - | ||||||||||||||||||||||||||||||
| 1661 | newtarget = isContentFlowReversed()
| 904-934 | ||||||||||||||||||||||||||||||
| 1662 | } executed 1838 times by 1 test: end of blockExecuted by:
| 1838 | ||||||||||||||||||||||||||||||
| 1663 | if (velocity < 0
| 12-934 | ||||||||||||||||||||||||||||||
| 1664 | newtarget = maxExtent - overshootDist; executed 12 times by 1 test: newtarget = maxExtent - overshootDist;Executed by:
| 12 | ||||||||||||||||||||||||||||||
| 1665 | else if (velocity > 0
| 13-922 | ||||||||||||||||||||||||||||||
| 1666 | newtarget = minExtent + overshootDist; executed 13 times by 1 test: newtarget = minExtent + overshootDist;Executed by:
| 13 | ||||||||||||||||||||||||||||||
| 1667 | if (newtarget == data.flickTarget
| 16-1822 | ||||||||||||||||||||||||||||||
| 1668 | if (qAbs(velocity) < MinimumFlickVelocity
| 93-1729 | ||||||||||||||||||||||||||||||
| 1669 | correctFlick = false; executed 93 times by 1 test: correctFlick = false;Executed by:
| 93 | ||||||||||||||||||||||||||||||
| 1670 | return executed 1822 times by 1 test: false;return false;Executed by:
executed 1822 times by 1 test: return false;Executed by:
| 1822 | ||||||||||||||||||||||||||||||
| 1671 | } | - | ||||||||||||||||||||||||||||||
| 1672 | data.flickTarget = newtarget; | - | ||||||||||||||||||||||||||||||
| 1673 | qreal dist = -newtarget + data.move.value(); | - | ||||||||||||||||||||||||||||||
| 1674 | if ((v < 0
| 0-8 | ||||||||||||||||||||||||||||||
| 1675 | correctFlick = false; | - | ||||||||||||||||||||||||||||||
| 1676 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1677 | fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 1678 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1679 | } | - | ||||||||||||||||||||||||||||||
| 1680 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1681 | timeline.accelDistance(data.move, v, -dist); | - | ||||||||||||||||||||||||||||||
| 1682 | timeline.callback(QQuickTimeLineCallback(&data.move, fixupCallback, this)); | - | ||||||||||||||||||||||||||||||
| 1683 | return executed 16 times by 1 test: false;return false;Executed by:
executed 16 times by 1 test: return false;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 1684 | } | - | ||||||||||||||||||||||||||||||
| 1685 | } else { | - | ||||||||||||||||||||||||||||||
| 1686 | correctFlick = false; | - | ||||||||||||||||||||||||||||||
| 1687 | timeline.reset(data.move); | - | ||||||||||||||||||||||||||||||
| 1688 | fixup(data, minExtent, maxExtent); | - | ||||||||||||||||||||||||||||||
| 1689 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1690 | } | - | ||||||||||||||||||||||||||||||
| 1691 | } | - | ||||||||||||||||||||||||||||||
| 1692 | QQuickListView::QQuickListView(QQuickItem *parent) | - | ||||||||||||||||||||||||||||||
| 1693 | : QQuickItemView(*(new QQuickListViewPrivate), parent) | - | ||||||||||||||||||||||||||||||
| 1694 | { | - | ||||||||||||||||||||||||||||||
| 1695 | } executed 1920 times by 11 tests: end of blockExecuted by:
| 1920 | ||||||||||||||||||||||||||||||
| 1696 | - | |||||||||||||||||||||||||||||||
| 1697 | QQuickListView::~QQuickListView() | - | ||||||||||||||||||||||||||||||
| 1698 | { | - | ||||||||||||||||||||||||||||||
| 1699 | } | - | ||||||||||||||||||||||||||||||
| 1700 | void QQuickListView::setHighlightFollowsCurrentItem(bool autoHighlight) | - | ||||||||||||||||||||||||||||||
| 1701 | { | - | ||||||||||||||||||||||||||||||
| 1702 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1703 | if (d->autoHighlight != autoHighlight
| 10-12 | ||||||||||||||||||||||||||||||
| 1704 | if (!autoHighlight
| 0-12 | ||||||||||||||||||||||||||||||
| 1705 | if (d->highlightPosAnimator
| 4-8 | ||||||||||||||||||||||||||||||
| 1706 | d->highlightPosAnimator->stop(); executed 4 times by 1 test: d->highlightPosAnimator->stop();Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1707 | if (d->highlightWidthAnimator
| 4-8 | ||||||||||||||||||||||||||||||
| 1708 | d->highlightWidthAnimator->stop(); executed 4 times by 1 test: d->highlightWidthAnimator->stop();Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1709 | if (d->highlightHeightAnimator
| 4-8 | ||||||||||||||||||||||||||||||
| 1710 | d->highlightHeightAnimator->stop(); executed 4 times by 1 test: d->highlightHeightAnimator->stop();Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 1711 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 1712 | QQuickItemView::setHighlightFollowsCurrentItem(autoHighlight); | - | ||||||||||||||||||||||||||||||
| 1713 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 1714 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 1715 | qreal QQuickListView::spacing() const | - | ||||||||||||||||||||||||||||||
| 1716 | { | - | ||||||||||||||||||||||||||||||
| 1717 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1718 | return executed 8 times by 1 test: d->spacing;return d->spacing;Executed by:
executed 8 times by 1 test: return d->spacing;Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 1719 | } | - | ||||||||||||||||||||||||||||||
| 1720 | - | |||||||||||||||||||||||||||||||
| 1721 | void QQuickListView::setSpacing(qreal spacing) | - | ||||||||||||||||||||||||||||||
| 1722 | { | - | ||||||||||||||||||||||||||||||
| 1723 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1724 | if (spacing != d->spacing
| 0-22 | ||||||||||||||||||||||||||||||
| 1725 | d->spacing = spacing; | - | ||||||||||||||||||||||||||||||
| 1726 | d->forceLayoutPolish(); | - | ||||||||||||||||||||||||||||||
| 1727 | spacingChanged(); | - | ||||||||||||||||||||||||||||||
| 1728 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 1729 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 1730 | QQuickListView::Orientation QQuickListView::orientation() const | - | ||||||||||||||||||||||||||||||
| 1731 | { | - | ||||||||||||||||||||||||||||||
| 1732 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1733 | return executed 982477 times by 10 tests: d->orient;return d->orient;Executed by:
executed 982477 times by 10 tests: return d->orient;Executed by:
| 982477 | ||||||||||||||||||||||||||||||
| 1734 | } | - | ||||||||||||||||||||||||||||||
| 1735 | - | |||||||||||||||||||||||||||||||
| 1736 | void QQuickListView::setOrientation(QQuickListView::Orientation orientation) | - | ||||||||||||||||||||||||||||||
| 1737 | { | - | ||||||||||||||||||||||||||||||
| 1738 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1739 | if (d->orient != orientation
| 136-194 | ||||||||||||||||||||||||||||||
| 1740 | d->orient = orientation; | - | ||||||||||||||||||||||||||||||
| 1741 | if (d->orient == Vertical
| 24-170 | ||||||||||||||||||||||||||||||
| 1742 | if (d->flickableDirection == HorizontalFlick
| 0-24 | ||||||||||||||||||||||||||||||
| 1743 | setFlickableDirection(VerticalFlick); | - | ||||||||||||||||||||||||||||||
| 1744 | if (isComponentComplete()
| 0-24 | ||||||||||||||||||||||||||||||
| 1745 | setContentWidth(-1); executed 24 times by 1 test: setContentWidth(-1);Executed by:
| 24 | ||||||||||||||||||||||||||||||
| 1746 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||||||||
| 1747 | setContentX(0); | - | ||||||||||||||||||||||||||||||
| 1748 | } executed 24 times by 1 test: else {end of blockExecuted by:
| 24 | ||||||||||||||||||||||||||||||
| 1749 | if (d->flickableDirection == VerticalFlick
| 2-168 | ||||||||||||||||||||||||||||||
| 1750 | setFlickableDirection(HorizontalFlick); | - | ||||||||||||||||||||||||||||||
| 1751 | if (isComponentComplete()
| 20-148 | ||||||||||||||||||||||||||||||
| 1752 | setContentHeight(-1); executed 20 times by 1 test: setContentHeight(-1);Executed by:
| 20 | ||||||||||||||||||||||||||||||
| 1753 | } executed 168 times by 2 tests: end of blockExecuted by:
| 168 | ||||||||||||||||||||||||||||||
| 1754 | setContentY(0); | - | ||||||||||||||||||||||||||||||
| 1755 | } executed 170 times by 2 tests: end of blockExecuted by:
| 170 | ||||||||||||||||||||||||||||||
| 1756 | d->regenerate(true); | - | ||||||||||||||||||||||||||||||
| 1757 | orientationChanged(); | - | ||||||||||||||||||||||||||||||
| 1758 | } executed 194 times by 2 tests: end of blockExecuted by:
| 194 | ||||||||||||||||||||||||||||||
| 1759 | } executed 330 times by 2 tests: end of blockExecuted by:
| 330 | ||||||||||||||||||||||||||||||
| 1760 | QQuickViewSection *QQuickListView::sectionCriteria() | - | ||||||||||||||||||||||||||||||
| 1761 | { | - | ||||||||||||||||||||||||||||||
| 1762 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1763 | if (!d->sectionCriteria
| 6-46 | ||||||||||||||||||||||||||||||
| 1764 | d->sectionCriteria = new QQuickViewSection(this); executed 46 times by 4 tests: d->sectionCriteria = new QQuickViewSection(this);Executed by:
| 46 | ||||||||||||||||||||||||||||||
| 1765 | return executed 52 times by 4 tests: d->sectionCriteria;return d->sectionCriteria;Executed by:
executed 52 times by 4 tests: return d->sectionCriteria;Executed by:
| 52 | ||||||||||||||||||||||||||||||
| 1766 | } | - | ||||||||||||||||||||||||||||||
| 1767 | - | |||||||||||||||||||||||||||||||
| 1768 | - | |||||||||||||||||||||||||||||||
| 1769 | - | |||||||||||||||||||||||||||||||
| 1770 | - | |||||||||||||||||||||||||||||||
| 1771 | - | |||||||||||||||||||||||||||||||
| 1772 | QString QQuickListView::currentSection() const | - | ||||||||||||||||||||||||||||||
| 1773 | { | - | ||||||||||||||||||||||||||||||
| 1774 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1775 | return executed 56 times by 1 test: d->currentSection;return d->currentSection;Executed by:
executed 56 times by 1 test: return d->currentSection;Executed by:
| 56 | ||||||||||||||||||||||||||||||
| 1776 | } | - | ||||||||||||||||||||||||||||||
| 1777 | qreal QQuickListView::highlightMoveVelocity() const | - | ||||||||||||||||||||||||||||||
| 1778 | { | - | ||||||||||||||||||||||||||||||
| 1779 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1780 | return executed 16 times by 1 test: d->highlightMoveVelocity;return d->highlightMoveVelocity;Executed by:
executed 16 times by 1 test: return d->highlightMoveVelocity;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 1781 | } | - | ||||||||||||||||||||||||||||||
| 1782 | - | |||||||||||||||||||||||||||||||
| 1783 | void QQuickListView::setHighlightMoveVelocity(qreal speed) | - | ||||||||||||||||||||||||||||||
| 1784 | { | - | ||||||||||||||||||||||||||||||
| 1785 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1786 | if (d->highlightMoveVelocity != speed
| 6-582 | ||||||||||||||||||||||||||||||
| 1787 | d->highlightMoveVelocity = speed; | - | ||||||||||||||||||||||||||||||
| 1788 | if (d->highlightPosAnimator
| 0-582 | ||||||||||||||||||||||||||||||
| 1789 | d->highlightPosAnimator->velocity = d->highlightMoveVelocity; never executed: d->highlightPosAnimator->velocity = d->highlightMoveVelocity; | 0 | ||||||||||||||||||||||||||||||
| 1790 | highlightMoveVelocityChanged(); | - | ||||||||||||||||||||||||||||||
| 1791 | } executed 582 times by 1 test: end of blockExecuted by:
| 582 | ||||||||||||||||||||||||||||||
| 1792 | } executed 588 times by 1 test: end of blockExecuted by:
| 588 | ||||||||||||||||||||||||||||||
| 1793 | - | |||||||||||||||||||||||||||||||
| 1794 | void QQuickListView::setHighlightMoveDuration(int duration) | - | ||||||||||||||||||||||||||||||
| 1795 | { | - | ||||||||||||||||||||||||||||||
| 1796 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1797 | if (d->highlightMoveDuration != duration
| 2-6 | ||||||||||||||||||||||||||||||
| 1798 | if (d->highlightPosAnimator
| 0-2 | ||||||||||||||||||||||||||||||
| 1799 | d->highlightPosAnimator->userDuration = duration; executed 2 times by 1 test: d->highlightPosAnimator->userDuration = duration;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 1800 | QQuickItemView::setHighlightMoveDuration(duration); | - | ||||||||||||||||||||||||||||||
| 1801 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 1802 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||||||||
| 1803 | - | |||||||||||||||||||||||||||||||
| 1804 | qreal QQuickListView::highlightResizeVelocity() const | - | ||||||||||||||||||||||||||||||
| 1805 | { | - | ||||||||||||||||||||||||||||||
| 1806 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1807 | return executed 16 times by 1 test: d->highlightResizeVelocity;return d->highlightResizeVelocity;Executed by:
executed 16 times by 1 test: return d->highlightResizeVelocity;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 1808 | } | - | ||||||||||||||||||||||||||||||
| 1809 | - | |||||||||||||||||||||||||||||||
| 1810 | void QQuickListView::setHighlightResizeVelocity(qreal speed) | - | ||||||||||||||||||||||||||||||
| 1811 | { | - | ||||||||||||||||||||||||||||||
| 1812 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1813 | if (d->highlightResizeVelocity != speed
| 0-566 | ||||||||||||||||||||||||||||||
| 1814 | d->highlightResizeVelocity = speed; | - | ||||||||||||||||||||||||||||||
| 1815 | if (d->highlightWidthAnimator
| 0-566 | ||||||||||||||||||||||||||||||
| 1816 | d->highlightWidthAnimator->velocity = d->highlightResizeVelocity; never executed: d->highlightWidthAnimator->velocity = d->highlightResizeVelocity; | 0 | ||||||||||||||||||||||||||||||
| 1817 | if (d->highlightHeightAnimator
| 0-566 | ||||||||||||||||||||||||||||||
| 1818 | d->highlightHeightAnimator->velocity = d->highlightResizeVelocity; never executed: d->highlightHeightAnimator->velocity = d->highlightResizeVelocity; | 0 | ||||||||||||||||||||||||||||||
| 1819 | highlightResizeVelocityChanged(); | - | ||||||||||||||||||||||||||||||
| 1820 | } executed 566 times by 1 test: end of blockExecuted by:
| 566 | ||||||||||||||||||||||||||||||
| 1821 | } executed 566 times by 1 test: end of blockExecuted by:
| 566 | ||||||||||||||||||||||||||||||
| 1822 | - | |||||||||||||||||||||||||||||||
| 1823 | int QQuickListView::highlightResizeDuration() const | - | ||||||||||||||||||||||||||||||
| 1824 | { | - | ||||||||||||||||||||||||||||||
| 1825 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1826 | return never executed: d->highlightResizeDuration;return d->highlightResizeDuration;never executed: return d->highlightResizeDuration; | 0 | ||||||||||||||||||||||||||||||
| 1827 | } | - | ||||||||||||||||||||||||||||||
| 1828 | - | |||||||||||||||||||||||||||||||
| 1829 | void QQuickListView::setHighlightResizeDuration(int duration) | - | ||||||||||||||||||||||||||||||
| 1830 | { | - | ||||||||||||||||||||||||||||||
| 1831 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1832 | if (d->highlightResizeDuration != duration
| 0 | ||||||||||||||||||||||||||||||
| 1833 | d->highlightResizeDuration = duration; | - | ||||||||||||||||||||||||||||||
| 1834 | if (d->highlightWidthAnimator
| 0 | ||||||||||||||||||||||||||||||
| 1835 | d->highlightWidthAnimator->userDuration = d->highlightResizeDuration; never executed: d->highlightWidthAnimator->userDuration = d->highlightResizeDuration; | 0 | ||||||||||||||||||||||||||||||
| 1836 | if (d->highlightHeightAnimator
| 0 | ||||||||||||||||||||||||||||||
| 1837 | d->highlightHeightAnimator->userDuration = d->highlightResizeDuration; never executed: d->highlightHeightAnimator->userDuration = d->highlightResizeDuration; | 0 | ||||||||||||||||||||||||||||||
| 1838 | highlightResizeDurationChanged(); | - | ||||||||||||||||||||||||||||||
| 1839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1840 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1841 | QQuickListView::SnapMode QQuickListView::snapMode() const | - | ||||||||||||||||||||||||||||||
| 1842 | { | - | ||||||||||||||||||||||||||||||
| 1843 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1844 | return executed 16 times by 1 test: d->snapMode;return d->snapMode;Executed by:
executed 16 times by 1 test: return d->snapMode;Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 1845 | } | - | ||||||||||||||||||||||||||||||
| 1846 | - | |||||||||||||||||||||||||||||||
| 1847 | void QQuickListView::setSnapMode(SnapMode mode) | - | ||||||||||||||||||||||||||||||
| 1848 | { | - | ||||||||||||||||||||||||||||||
| 1849 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1850 | if (d->snapMode != mode
| 4-88 | ||||||||||||||||||||||||||||||
| 1851 | d->snapMode = mode; | - | ||||||||||||||||||||||||||||||
| 1852 | snapModeChanged(); | - | ||||||||||||||||||||||||||||||
| 1853 | d->fixupPosition(); | - | ||||||||||||||||||||||||||||||
| 1854 | } executed 88 times by 2 tests: end of blockExecuted by:
| 88 | ||||||||||||||||||||||||||||||
| 1855 | } executed 92 times by 2 tests: end of blockExecuted by:
| 92 | ||||||||||||||||||||||||||||||
| 1856 | QQuickListView::HeaderPositioning QQuickListView::headerPositioning() const | - | ||||||||||||||||||||||||||||||
| 1857 | { | - | ||||||||||||||||||||||||||||||
| 1858 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1859 | return never executed: d->headerPositioning;return d->headerPositioning;never executed: return d->headerPositioning; | 0 | ||||||||||||||||||||||||||||||
| 1860 | } | - | ||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||
| 1862 | void QQuickListView::setHeaderPositioning(QQuickListView::HeaderPositioning positioning) | - | ||||||||||||||||||||||||||||||
| 1863 | { | - | ||||||||||||||||||||||||||||||
| 1864 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1865 | if (d->headerPositioning != positioning
| 0-86 | ||||||||||||||||||||||||||||||
| 1866 | d->applyPendingChanges(); | - | ||||||||||||||||||||||||||||||
| 1867 | d->headerPositioning = positioning; | - | ||||||||||||||||||||||||||||||
| 1868 | if (isComponentComplete()
| 0-86 | ||||||||||||||||||||||||||||||
| 1869 | d->updateHeader(); | - | ||||||||||||||||||||||||||||||
| 1870 | d->updateViewport(); | - | ||||||||||||||||||||||||||||||
| 1871 | d->fixupPosition(); | - | ||||||||||||||||||||||||||||||
| 1872 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1873 | headerPositioningChanged(); | - | ||||||||||||||||||||||||||||||
| 1874 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||||||||
| 1875 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||||||||
| 1876 | QQuickListView::FooterPositioning QQuickListView::footerPositioning() const | - | ||||||||||||||||||||||||||||||
| 1877 | { | - | ||||||||||||||||||||||||||||||
| 1878 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1879 | return never executed: d->footerPositioning;return d->footerPositioning;never executed: return d->footerPositioning; | 0 | ||||||||||||||||||||||||||||||
| 1880 | } | - | ||||||||||||||||||||||||||||||
| 1881 | - | |||||||||||||||||||||||||||||||
| 1882 | void QQuickListView::setFooterPositioning(QQuickListView::FooterPositioning positioning) | - | ||||||||||||||||||||||||||||||
| 1883 | { | - | ||||||||||||||||||||||||||||||
| 1884 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1885 | if (d->footerPositioning != positioning
| 0-82 | ||||||||||||||||||||||||||||||
| 1886 | d->applyPendingChanges(); | - | ||||||||||||||||||||||||||||||
| 1887 | d->footerPositioning = positioning; | - | ||||||||||||||||||||||||||||||
| 1888 | if (isComponentComplete()
| 0-82 | ||||||||||||||||||||||||||||||
| 1889 | d->updateFooter(); | - | ||||||||||||||||||||||||||||||
| 1890 | d->updateViewport(); | - | ||||||||||||||||||||||||||||||
| 1891 | d->fixupPosition(); | - | ||||||||||||||||||||||||||||||
| 1892 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1893 | footerPositioningChanged(); | - | ||||||||||||||||||||||||||||||
| 1894 | } executed 82 times by 1 test: end of blockExecuted by:
| 82 | ||||||||||||||||||||||||||||||
| 1895 | } executed 82 times by 1 test: end of blockExecuted by:
| 82 | ||||||||||||||||||||||||||||||
| 1896 | void QQuickListView::viewportMoved(Qt::Orientations orient) | - | ||||||||||||||||||||||||||||||
| 1897 | { | - | ||||||||||||||||||||||||||||||
| 1898 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1899 | QQuickItemView::viewportMoved(orient); | - | ||||||||||||||||||||||||||||||
| 1900 | - | |||||||||||||||||||||||||||||||
| 1901 | if (!d->itemCount
| 562-9580 | ||||||||||||||||||||||||||||||
| 1902 | if (d->hasStickyHeader()
| 86-476 | ||||||||||||||||||||||||||||||
| 1903 | d->updateHeader(); executed 86 times by 1 test: d->updateHeader();Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 1904 | if (d->hasStickyFooter()
| 62-500 | ||||||||||||||||||||||||||||||
| 1905 | d->updateFooter(); executed 62 times by 1 test: d->updateFooter();Executed by:
| 62 | ||||||||||||||||||||||||||||||
| 1906 | return; executed 562 times by 2 tests: return;Executed by:
| 562 | ||||||||||||||||||||||||||||||
| 1907 | } | - | ||||||||||||||||||||||||||||||
| 1908 | - | |||||||||||||||||||||||||||||||
| 1909 | - | |||||||||||||||||||||||||||||||
| 1910 | if (d->inViewportMoved
| 27-9553 | ||||||||||||||||||||||||||||||
| 1911 | return; executed 27 times by 1 test: return;Executed by:
| 27 | ||||||||||||||||||||||||||||||
| 1912 | d->inViewportMoved = true; | - | ||||||||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||||||||
| 1914 | if (yflick()
| 3384-6169 | ||||||||||||||||||||||||||||||
| 1915 | if (d->isBottomToTop()
| 1566-4603 | ||||||||||||||||||||||||||||||
| 1916 | d->bufferMode = d->vData.smoothVelocity < 0
executed 1566 times by 1 test: d->bufferMode = d->vData.smoothVelocity < 0 ? QQuickListViewPrivate::BufferAfter : QQuickListViewPrivate::BufferBefore;Executed by:
| 709-1566 | ||||||||||||||||||||||||||||||
| 1917 | else | - | ||||||||||||||||||||||||||||||
| 1918 | d->bufferMode = d->vData.smoothVelocity < 0
executed 4603 times by 5 tests: d->bufferMode = d->vData.smoothVelocity < 0 ? QQuickListViewPrivate::BufferBefore : QQuickListViewPrivate::BufferAfter;Executed by:
| 1423-4603 | ||||||||||||||||||||||||||||||
| 1919 | } else { | - | ||||||||||||||||||||||||||||||
| 1920 | if (d->isRightToLeft()
| 1533-1851 | ||||||||||||||||||||||||||||||
| 1921 | d->bufferMode = d->hData.smoothVelocity < 0
executed 1533 times by 1 test: d->bufferMode = d->hData.smoothVelocity < 0 ? QQuickListViewPrivate::BufferAfter : QQuickListViewPrivate::BufferBefore;Executed by:
| 710-1533 | ||||||||||||||||||||||||||||||
| 1922 | else | - | ||||||||||||||||||||||||||||||
| 1923 | d->bufferMode = d->hData.smoothVelocity < 0
executed 1851 times by 2 tests: d->bufferMode = d->hData.smoothVelocity < 0 ? QQuickListViewPrivate::BufferBefore : QQuickListViewPrivate::BufferAfter;Executed by:
| 744-1851 | ||||||||||||||||||||||||||||||
| 1924 | } | - | ||||||||||||||||||||||||||||||
| 1925 | - | |||||||||||||||||||||||||||||||
| 1926 | d->refillOrLayout(); | - | ||||||||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||||||||
| 1929 | qreal from = d->isContentFlowReversed()
| 3099-6454 | ||||||||||||||||||||||||||||||
| 1930 | qreal to = d->isContentFlowReversed()
| 3099-6454 | ||||||||||||||||||||||||||||||
| 1931 | for (FxViewItem *item : qAsConst(d->visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 1932 | if (item->item
| 0-87351 | ||||||||||||||||||||||||||||||
| 1933 | QQuickItemPrivate::get(item->item)->setCulled(item->endPosition() < from || item->position() > to); executed 87351 times by 5 tests: QQuickItemPrivate::get(item->item)->setCulled(item->endPosition() < from || item->position() > to);Executed by:
| 87351 | ||||||||||||||||||||||||||||||
| 1934 | } executed 87351 times by 5 tests: end of blockExecuted by:
| 87351 | ||||||||||||||||||||||||||||||
| 1935 | if (d->currentItem
| 40-9513 | ||||||||||||||||||||||||||||||
| 1936 | QQuickItemPrivate::get(d->currentItem->item)->setCulled(d->currentItem->endPosition() < from || d->currentItem->position() > to); executed 9513 times by 5 tests: QQuickItemPrivate::get(d->currentItem->item)->setCulled(d->currentItem->endPosition() < from || d->currentItem->position() > to);Executed by:
| 9513 | ||||||||||||||||||||||||||||||
| 1937 | - | |||||||||||||||||||||||||||||||
| 1938 | if (d->hData.flicking
| 306-6794 | ||||||||||||||||||||||||||||||
| 1939 | d->moveReason = QQuickListViewPrivate::Mouse; executed 7392 times by 1 test: d->moveReason = QQuickListViewPrivate::Mouse;Executed by:
| 7392 | ||||||||||||||||||||||||||||||
| 1940 | if (d->moveReason != QQuickListViewPrivate::SetIndex
| 1069-8484 | ||||||||||||||||||||||||||||||
| 1941 | if (d->haveHighlightRange
| 0-5497 | ||||||||||||||||||||||||||||||
| 1942 | - | |||||||||||||||||||||||||||||||
| 1943 | qreal pos = d->highlight->position(); | - | ||||||||||||||||||||||||||||||
| 1944 | qreal viewPos = d->isContentFlowReversed()
| 1217-1730 | ||||||||||||||||||||||||||||||
| 1945 | if (pos > viewPos + d->highlightRangeEnd - d->highlight->size()
| 1405-1542 | ||||||||||||||||||||||||||||||
| 1946 | pos = viewPos + d->highlightRangeEnd - d->highlight->size(); executed 1542 times by 1 test: pos = viewPos + d->highlightRangeEnd - d->highlight->size();Executed by:
| 1542 | ||||||||||||||||||||||||||||||
| 1947 | if (pos < viewPos + d->highlightRangeStart
| 1263-1684 | ||||||||||||||||||||||||||||||
| 1948 | pos = viewPos + d->highlightRangeStart; executed 1684 times by 1 test: pos = viewPos + d->highlightRangeStart;Executed by:
| 1684 | ||||||||||||||||||||||||||||||
| 1949 | if (pos != d->highlight->position()
| 62-2885 | ||||||||||||||||||||||||||||||
| 1950 | d->highlightPosAnimator->stop(); | - | ||||||||||||||||||||||||||||||
| 1951 | static_cast<FxListItemSG*>(d->highlight)->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 1952 | } executed 2885 times by 1 test: else {end of blockExecuted by:
| 2885 | ||||||||||||||||||||||||||||||
| 1953 | d->updateHighlight(); | - | ||||||||||||||||||||||||||||||
| 1954 | } executed 62 times by 1 test: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||||||||
| 1955 | - | |||||||||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||||||||
| 1957 | if (FxViewItem *snapItem = d->snapItemAt(d->highlight->position())
| 208-2739 | ||||||||||||||||||||||||||||||
| 1958 | if (snapItem->index >= 0
| 0-2739 | ||||||||||||||||||||||||||||||
| 1959 | d->updateCurrent(snapItem->index); executed 234 times by 1 test: d->updateCurrent(snapItem->index);Executed by:
| 234 | ||||||||||||||||||||||||||||||
| 1960 | } executed 2739 times by 1 test: end of blockExecuted by:
| 2739 | ||||||||||||||||||||||||||||||
| 1961 | } executed 2947 times by 1 test: end of blockExecuted by:
| 2947 | ||||||||||||||||||||||||||||||
| 1962 | } executed 8484 times by 4 tests: end of blockExecuted by:
| 8484 | ||||||||||||||||||||||||||||||
| 1963 | - | |||||||||||||||||||||||||||||||
| 1964 | if ((d->hData.flicking
| 0-6794 | ||||||||||||||||||||||||||||||
| 1965 | d->inFlickCorrection = true; | - | ||||||||||||||||||||||||||||||
| 1966 | - | |||||||||||||||||||||||||||||||
| 1967 | - | |||||||||||||||||||||||||||||||
| 1968 | if (yflick()
| 142-1576 | ||||||||||||||||||||||||||||||
| 1969 | if (d->vData.velocity > 0
| 635-799 | ||||||||||||||||||||||||||||||
| 1970 | const qreal minY = minYExtent(); | - | ||||||||||||||||||||||||||||||
| 1971 | if ((minY - d->vData.move.value() < height()/2
| 54-426 | ||||||||||||||||||||||||||||||
| 1972 | && minY != d->vData.flickTarget
| 130-451 | ||||||||||||||||||||||||||||||
| 1973 | d->flickY(-d->vData.smoothVelocity.value()); executed 451 times by 1 test: d->flickY(-d->vData.smoothVelocity.value());Executed by:
| 451 | ||||||||||||||||||||||||||||||
| 1974 | } executed 635 times by 1 test: else if (d->vData.velocity < 0end of blockExecuted by:
| 0-799 | ||||||||||||||||||||||||||||||
| 1975 | const qreal maxY = maxYExtent(); | - | ||||||||||||||||||||||||||||||
| 1976 | if ((d->vData.move.value() - maxY < height()/2
| 121-519 | ||||||||||||||||||||||||||||||
| 1977 | && maxY != d->vData.flickTarget
| 197-481 | ||||||||||||||||||||||||||||||
| 1978 | d->flickY(-d->vData.smoothVelocity.value()); executed 481 times by 1 test: d->flickY(-d->vData.smoothVelocity.value());Executed by:
| 481 | ||||||||||||||||||||||||||||||
| 1979 | } executed 799 times by 1 test: end of blockExecuted by:
| 799 | ||||||||||||||||||||||||||||||
| 1980 | } executed 1434 times by 1 test: end of blockExecuted by:
| 1434 | ||||||||||||||||||||||||||||||
| 1981 | - | |||||||||||||||||||||||||||||||
| 1982 | if (xflick()
| 82-1576 | ||||||||||||||||||||||||||||||
| 1983 | if (d->hData.velocity > 0
| 601-602 | ||||||||||||||||||||||||||||||
| 1984 | const qreal minX = minXExtent(); | - | ||||||||||||||||||||||||||||||
| 1985 | if ((minX - d->hData.move.value() < width()/2
| 28-400 | ||||||||||||||||||||||||||||||
| 1986 | && minX != d->hData.flickTarget
| 120-453 | ||||||||||||||||||||||||||||||
| 1987 | d->flickX(-d->hData.smoothVelocity.value()); executed 453 times by 1 test: d->flickX(-d->hData.smoothVelocity.value());Executed by:
| 453 | ||||||||||||||||||||||||||||||
| 1988 | } executed 601 times by 1 test: else if (d->hData.velocity < 0end of blockExecuted by:
| 0-602 | ||||||||||||||||||||||||||||||
| 1989 | const qreal maxX = maxXExtent(); | - | ||||||||||||||||||||||||||||||
| 1990 | if ((d->hData.move.value() - maxX < width()/2
| 28-402 | ||||||||||||||||||||||||||||||
| 1991 | && maxX != d->hData.flickTarget
| 120-454 | ||||||||||||||||||||||||||||||
| 1992 | d->flickX(-d->hData.smoothVelocity.value()); executed 454 times by 1 test: d->flickX(-d->hData.smoothVelocity.value());Executed by:
| 454 | ||||||||||||||||||||||||||||||
| 1993 | } executed 602 times by 1 test: end of blockExecuted by:
| 602 | ||||||||||||||||||||||||||||||
| 1994 | } executed 1203 times by 1 test: end of blockExecuted by:
| 1203 | ||||||||||||||||||||||||||||||
| 1995 | d->inFlickCorrection = false; | - | ||||||||||||||||||||||||||||||
| 1996 | } executed 2861 times by 1 test: end of blockExecuted by:
| 2861 | ||||||||||||||||||||||||||||||
| 1997 | if (d->hasStickyHeader()
| 186-9367 | ||||||||||||||||||||||||||||||
| 1998 | d->updateHeader(); executed 186 times by 1 test: d->updateHeader();Executed by:
| 186 | ||||||||||||||||||||||||||||||
| 1999 | if (d->hasStickyFooter()
| 222-9331 | ||||||||||||||||||||||||||||||
| 2000 | d->updateFooter(); executed 222 times by 1 test: d->updateFooter();Executed by:
| 222 | ||||||||||||||||||||||||||||||
| 2001 | if (d->sectionCriteria
| 472-9081 | ||||||||||||||||||||||||||||||
| 2002 | d->updateCurrentSection(); | - | ||||||||||||||||||||||||||||||
| 2003 | d->updateStickySections(); | - | ||||||||||||||||||||||||||||||
| 2004 | } executed 472 times by 2 tests: end of blockExecuted by:
| 472 | ||||||||||||||||||||||||||||||
| 2005 | d->inViewportMoved = false; | - | ||||||||||||||||||||||||||||||
| 2006 | } executed 9553 times by 5 tests: end of blockExecuted by:
| 9553 | ||||||||||||||||||||||||||||||
| 2007 | - | |||||||||||||||||||||||||||||||
| 2008 | void QQuickListView::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||||||||
| 2009 | { | - | ||||||||||||||||||||||||||||||
| 2010 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2011 | if (d->model && d->model->count()
| 0-90 | ||||||||||||||||||||||||||||||
| 2012 | || (d->explicitKeyNavigationEnabled
| 2-4 | ||||||||||||||||||||||||||||||
| 2013 | if ((d->orient == QQuickListView::Horizontal
| 0-86 | ||||||||||||||||||||||||||||||
| 2014 | || (d->orient == QQuickListView::Horizontal
| 0-86 | ||||||||||||||||||||||||||||||
| 2015 | || (d->orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 2016 | || (d->orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 2017 | if (currentIndex() > 0
| 0 | ||||||||||||||||||||||||||||||
| 2018 | decrementCurrentIndex(); | - | ||||||||||||||||||||||||||||||
| 2019 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2020 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2021 | } else if (d->wrap
| 0 | ||||||||||||||||||||||||||||||
| 2022 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2023 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2024 | } | - | ||||||||||||||||||||||||||||||
| 2025 | } never executed: else if ((d->orient == QQuickListView::Horizontalend of block
| 0-86 | ||||||||||||||||||||||||||||||
| 2026 | || (d->orient == QQuickListView::Horizontal
| 0-86 | ||||||||||||||||||||||||||||||
| 2027 | || (d->orient == QQuickListView::Vertical
| 0-86 | ||||||||||||||||||||||||||||||
| 2028 | || (d->orient == QQuickListView::Vertical
| 0 | ||||||||||||||||||||||||||||||
| 2029 | if (currentIndex() < d->model->count() - 1
| 0-86 | ||||||||||||||||||||||||||||||
| 2030 | incrementCurrentIndex(); | - | ||||||||||||||||||||||||||||||
| 2031 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2032 | return; executed 86 times by 1 test: return;Executed by:
| 86 | ||||||||||||||||||||||||||||||
| 2033 | } else if (d->wrap
| 0 | ||||||||||||||||||||||||||||||
| 2034 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 2035 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2036 | } | - | ||||||||||||||||||||||||||||||
| 2037 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2038 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2039 | event->ignore(); | - | ||||||||||||||||||||||||||||||
| 2040 | QQuickItemView::keyPressEvent(event); | - | ||||||||||||||||||||||||||||||
| 2041 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 2042 | - | |||||||||||||||||||||||||||||||
| 2043 | void QQuickListView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | - | ||||||||||||||||||||||||||||||
| 2044 | { | - | ||||||||||||||||||||||||||||||
| 2045 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2046 | if (d->isRightToLeft()
| 72-4000 | ||||||||||||||||||||||||||||||
| 2047 | - | |||||||||||||||||||||||||||||||
| 2048 | qreal dx = newGeometry.width() - oldGeometry.width(); | - | ||||||||||||||||||||||||||||||
| 2049 | setContentX(contentX() - dx); | - | ||||||||||||||||||||||||||||||
| 2050 | } executed 72 times by 1 test: else if (d->isBottomToTop()end of blockExecuted by:
| 28-3972 | ||||||||||||||||||||||||||||||
| 2051 | - | |||||||||||||||||||||||||||||||
| 2052 | qreal dy = newGeometry.height() - oldGeometry.height(); | - | ||||||||||||||||||||||||||||||
| 2053 | setContentY(contentY() - dy); | - | ||||||||||||||||||||||||||||||
| 2054 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||||||||
| 2055 | QQuickItemView::geometryChanged(newGeometry, oldGeometry); | - | ||||||||||||||||||||||||||||||
| 2056 | } executed 4072 times by 9 tests: end of blockExecuted by:
| 4072 | ||||||||||||||||||||||||||||||
| 2057 | - | |||||||||||||||||||||||||||||||
| 2058 | void QQuickListView::initItem(int index, QObject *object) | - | ||||||||||||||||||||||||||||||
| 2059 | { | - | ||||||||||||||||||||||||||||||
| 2060 | QQuickItemView::initItem(index, object); | - | ||||||||||||||||||||||||||||||
| 2061 | - | |||||||||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||||||||
| 2063 | - | |||||||||||||||||||||||||||||||
| 2064 | QQuickItem *item = qmlobject_cast<QQuickItem*>(object); | - | ||||||||||||||||||||||||||||||
| 2065 | if (item
| 0-29948 | ||||||||||||||||||||||||||||||
| 2066 | QQuickListViewAttached *attached = static_cast<QQuickListViewAttached *>( | - | ||||||||||||||||||||||||||||||
| 2067 | qmlAttachedPropertiesObject<QQuickListView>(item)); | - | ||||||||||||||||||||||||||||||
| 2068 | if (attached
| 0-29948 | ||||||||||||||||||||||||||||||
| 2069 | attached->setView(this); executed 29948 times by 10 tests: attached->setView(this);Executed by:
| 29948 | ||||||||||||||||||||||||||||||
| 2070 | } executed 29948 times by 10 tests: end of blockExecuted by:
| 29948 | ||||||||||||||||||||||||||||||
| 2071 | } executed 29948 times by 10 tests: end of blockExecuted by:
| 29948 | ||||||||||||||||||||||||||||||
| 2072 | - | |||||||||||||||||||||||||||||||
| 2073 | qreal QQuickListView::maxYExtent() const | - | ||||||||||||||||||||||||||||||
| 2074 | { | - | ||||||||||||||||||||||||||||||
| 2075 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2076 | if (d->layoutOrientation() == Qt::Horizontal
| 48-54514 | ||||||||||||||||||||||||||||||
| 2077 | return executed 48 times by 1 test: QQuickFlickable::maxYExtent();return QQuickFlickable::maxYExtent();Executed by:
executed 48 times by 1 test: return QQuickFlickable::maxYExtent();Executed by:
| 48 | ||||||||||||||||||||||||||||||
| 2078 | return executed 60327 times by 11 tests: QQuickItemView::maxYExtent();return QQuickItemView::maxYExtent();Executed by:
executed 60327 times by 11 tests: return QQuickItemView::maxYExtent();Executed by:
| 60327 | ||||||||||||||||||||||||||||||
| 2079 | } | - | ||||||||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||||||||
| 2081 | qreal QQuickListView::maxXExtent() const | - | ||||||||||||||||||||||||||||||
| 2082 | { | - | ||||||||||||||||||||||||||||||
| 2083 | const QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2084 | if (d->layoutOrientation() == Qt::Vertical
| 80-27304 | ||||||||||||||||||||||||||||||
| 2085 | return executed 80 times by 2 tests: QQuickFlickable::maxXExtent();return QQuickFlickable::maxXExtent();Executed by:
executed 80 times by 2 tests: return QQuickFlickable::maxXExtent();Executed by:
| 80 | ||||||||||||||||||||||||||||||
| 2086 | return executed 44024 times by 11 tests: QQuickItemView::maxXExtent();return QQuickItemView::maxXExtent();Executed by:
executed 44024 times by 11 tests: return QQuickItemView::maxXExtent();Executed by:
| 44024 | ||||||||||||||||||||||||||||||
| 2087 | } | - | ||||||||||||||||||||||||||||||
| 2088 | void QQuickListView::incrementCurrentIndex() | - | ||||||||||||||||||||||||||||||
| 2089 | { | - | ||||||||||||||||||||||||||||||
| 2090 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2091 | int count = d->model
| 0-92 | ||||||||||||||||||||||||||||||
| 2092 | if (count
| 0-92 | ||||||||||||||||||||||||||||||
| 2093 | d->moveReason = QQuickListViewPrivate::SetIndex; | - | ||||||||||||||||||||||||||||||
| 2094 | int index = currentIndex()+1; | - | ||||||||||||||||||||||||||||||
| 2095 | setCurrentIndex((index >= 0 && index < count) ? index : 0); | - | ||||||||||||||||||||||||||||||
| 2096 | } executed 92 times by 1 test: end of blockExecuted by:
| 92 | ||||||||||||||||||||||||||||||
| 2097 | } executed 92 times by 1 test: end of blockExecuted by:
| 92 | ||||||||||||||||||||||||||||||
| 2098 | void QQuickListView::decrementCurrentIndex() | - | ||||||||||||||||||||||||||||||
| 2099 | { | - | ||||||||||||||||||||||||||||||
| 2100 | QQuickListViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2101 | int count = d->model
| 0-2 | ||||||||||||||||||||||||||||||
| 2102 | if (count
| 0-2 | ||||||||||||||||||||||||||||||
| 2103 | d->moveReason = QQuickListViewPrivate::SetIndex; | - | ||||||||||||||||||||||||||||||
| 2104 | int index = currentIndex()-1; | - | ||||||||||||||||||||||||||||||
| 2105 | setCurrentIndex((index >= 0 && index < count) ? index : count-1); | - | ||||||||||||||||||||||||||||||
| 2106 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 2107 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 2108 | - | |||||||||||||||||||||||||||||||
| 2109 | void QQuickListViewPrivate::updateSectionCriteria() | - | ||||||||||||||||||||||||||||||
| 2110 | { | - | ||||||||||||||||||||||||||||||
| 2111 | QQuickListView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2112 | if (q->isComponentComplete()
| 48-1994 | ||||||||||||||||||||||||||||||
| 2113 | QList<QByteArray> roles; | - | ||||||||||||||||||||||||||||||
| 2114 | if (sectionCriteria
| 0-1924 | ||||||||||||||||||||||||||||||
| 2115 | roles << sectionCriteria->property().toUtf8(); executed 64 times by 4 tests: roles << sectionCriteria->property().toUtf8();Executed by:
| 64 | ||||||||||||||||||||||||||||||
| 2116 | model->setWatchedRoles(roles); | - | ||||||||||||||||||||||||||||||
| 2117 | updateSections(); | - | ||||||||||||||||||||||||||||||
| 2118 | if (itemCount
| 16-1972 | ||||||||||||||||||||||||||||||
| 2119 | forceLayoutPolish(); executed 16 times by 2 tests: forceLayoutPolish();Executed by:
| 16 | ||||||||||||||||||||||||||||||
| 2120 | } executed 1988 times by 11 tests: end of blockExecuted by:
| 1988 | ||||||||||||||||||||||||||||||
| 2121 | } executed 2042 times by 11 tests: end of blockExecuted by:
| 2042 | ||||||||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||||||||
| 2123 | bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &change, ChangeResult *insertResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) | - | ||||||||||||||||||||||||||||||
| 2124 | { | - | ||||||||||||||||||||||||||||||
| 2125 | int modelIndex = change.index; | - | ||||||||||||||||||||||||||||||
| 2126 | int count = change.count; | - | ||||||||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||||||||
| 2128 | qreal tempPos = isContentFlowReversed()
| 108-1155 | ||||||||||||||||||||||||||||||
| 2129 | int index = visibleItems.count()
| 276-987 | ||||||||||||||||||||||||||||||
| 2130 | qreal lastVisiblePos = buffer + displayMarginEnd + tempPos + size(); | - | ||||||||||||||||||||||||||||||
| 2131 | - | |||||||||||||||||||||||||||||||
| 2132 | if (index < 0
| 272-991 | ||||||||||||||||||||||||||||||
| 2133 | int i = visibleItems.count() - 1; | - | ||||||||||||||||||||||||||||||
| 2134 | while (i > 0
| 0-254 | ||||||||||||||||||||||||||||||
| 2135 | -- never executed: i;--i;never executed: --i; | 0 | ||||||||||||||||||||||||||||||
| 2136 | if (i == 0
| 0-254 | ||||||||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||||||||
| 2138 | index = visibleItems.count(); | - | ||||||||||||||||||||||||||||||
| 2139 | } never executed: else if (visibleItems.at(i)->index + 1 == modelIndexend of block
| 0-207 | ||||||||||||||||||||||||||||||
| 2140 | && visibleItems.at(i)->endPosition() <= lastVisiblePos
| 4-203 | ||||||||||||||||||||||||||||||
| 2141 | - | |||||||||||||||||||||||||||||||
| 2142 | index = visibleItems.count(); | - | ||||||||||||||||||||||||||||||
| 2143 | } executed 203 times by 2 tests: else {end of blockExecuted by:
| 203 | ||||||||||||||||||||||||||||||
| 2144 | if (modelIndex < visibleIndex
| 24-45 | ||||||||||||||||||||||||||||||
| 2145 | - | |||||||||||||||||||||||||||||||
| 2146 | visibleIndex += count; | - | ||||||||||||||||||||||||||||||
| 2147 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 2148 | if (item->index != -1
| 0-670 | ||||||||||||||||||||||||||||||
| 2149 | item->index += count; executed 670 times by 1 test: item->index += count;Executed by:
| 670 | ||||||||||||||||||||||||||||||
| 2150 | } executed 670 times by 1 test: end of blockExecuted by:
| 670 | ||||||||||||||||||||||||||||||
| 2151 | } executed 45 times by 1 test: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||||||||
| 2152 | return executed 69 times by 1 test: true;return true;Executed by:
executed 69 times by 1 test: return true;Executed by:
| 69 | ||||||||||||||||||||||||||||||
| 2153 | } | - | ||||||||||||||||||||||||||||||
| 2154 | } | - | ||||||||||||||||||||||||||||||
| 2155 | - | |||||||||||||||||||||||||||||||
| 2156 | - | |||||||||||||||||||||||||||||||
| 2157 | qreal pos = 0; | - | ||||||||||||||||||||||||||||||
| 2158 | if (visibleItems.count()
| 276-918 | ||||||||||||||||||||||||||||||
| 2159 | pos = index < visibleItems.count()
| 203-715 | ||||||||||||||||||||||||||||||
| 2160 | : visibleItems.constLast()->endPosition() + spacing; | - | ||||||||||||||||||||||||||||||
| 2161 | } executed 918 times by 2 tests: end of blockExecuted by:
| 918 | ||||||||||||||||||||||||||||||
| 2162 | - | |||||||||||||||||||||||||||||||
| 2163 | - | |||||||||||||||||||||||||||||||
| 2164 | for (FxViewItem *item : qAsConst(visibleItems)) { | - | ||||||||||||||||||||||||||||||
| 2165 | if (item->index != -1
| 0-10307 | ||||||||||||||||||||||||||||||
| 2166 | item->index += count; | - | ||||||||||||||||||||||||||||||
| 2167 | if (change.isMove()
| 2464-3056 | ||||||||||||||||||||||||||||||
| 2168 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false); executed 2464 times by 1 test: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);Executed by:
| 2464 | ||||||||||||||||||||||||||||||
| 2169 | else | - | ||||||||||||||||||||||||||||||
| 2170 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false); executed 3056 times by 2 tests: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);Executed by:
| 3056 | ||||||||||||||||||||||||||||||
| 2171 | } | - | ||||||||||||||||||||||||||||||
| 2172 | } executed 10307 times by 2 tests: end of blockExecuted by:
| 10307 | ||||||||||||||||||||||||||||||
| 2173 | - | |||||||||||||||||||||||||||||||
| 2174 | bool visibleAffected = false; | - | ||||||||||||||||||||||||||||||
| 2175 | if (insertResult->visiblePos.isValid()
| 49-952 | ||||||||||||||||||||||||||||||
| 2176 | - | |||||||||||||||||||||||||||||||
| 2177 | int insertionIdx = index; | - | ||||||||||||||||||||||||||||||
| 2178 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 2179 | qreal from = tempPos - displayMarginBeginning - buffer; | - | ||||||||||||||||||||||||||||||
| 2180 | - | |||||||||||||||||||||||||||||||
| 2181 | if (insertionIdx < visibleIndex
| 19-30 | ||||||||||||||||||||||||||||||
| 2182 | if (pos >= from
| 7-12 | ||||||||||||||||||||||||||||||
| 2183 | - | |||||||||||||||||||||||||||||||
| 2184 | insertResult->sizeChangesBeforeVisiblePos += count * (averageSize + spacing); | - | ||||||||||||||||||||||||||||||
| 2185 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||||||||
| 2186 | } executed 19 times by 1 test: else {end of blockExecuted by:
| 19 | ||||||||||||||||||||||||||||||
| 2187 | for (i = count-1; i >= 0
| 10-38 | ||||||||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||||||||
| 2189 | FxViewItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 2190 | if (change.isMove()
| 0-18 | ||||||||||||||||||||||||||||||
| 2191 | item->index = modelIndex + i; never executed: item->index = modelIndex + i; | 0 | ||||||||||||||||||||||||||||||
| 2192 | if (!item
| 0-18 | ||||||||||||||||||||||||||||||
| 2193 | item = createItem(modelIndex + i, QQmlIncubator::Synchronous); executed 18 times by 1 test: item = createItem(modelIndex + i, QQmlIncubator::Synchronous);Executed by:
| 18 | ||||||||||||||||||||||||||||||
| 2194 | if (!item
| 0-18 | ||||||||||||||||||||||||||||||
| 2195 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2196 | - | |||||||||||||||||||||||||||||||
| 2197 | visibleAffected = true; | - | ||||||||||||||||||||||||||||||
| 2198 | visibleItems.insert(insertionIdx, item); | - | ||||||||||||||||||||||||||||||
| 2199 | if (insertionIdx == 0
| 9 | ||||||||||||||||||||||||||||||
| 2200 | insertResult->changedFirstItem = true; executed 9 times by 1 test: insertResult->changedFirstItem = true;Executed by:
| 9 | ||||||||||||||||||||||||||||||
| 2201 | if (!change.isMove()
| 0-18 | ||||||||||||||||||||||||||||||
| 2202 | addedItems->append(item); | - | ||||||||||||||||||||||||||||||
| 2203 | if (transitioner
| 0-18 | ||||||||||||||||||||||||||||||
| 2204 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); never executed: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); | 0 | ||||||||||||||||||||||||||||||
| 2205 | else | - | ||||||||||||||||||||||||||||||
| 2206 | static_cast< executed 18 times by 1 test: FxListItemSG *>(item)->setPosition(pos, true);static_cast<FxListItemSG *>(item)->setPosition(pos, true);Executed by:
executed 18 times by 1 test: static_cast<FxListItemSG *>(item)->setPosition(pos, true);Executed by:
| 18 | ||||||||||||||||||||||||||||||
| 2207 | } | - | ||||||||||||||||||||||||||||||
| 2208 | insertResult->sizeChangesBeforeVisiblePos += item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 2209 | pos -= item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 2210 | index++; | - | ||||||||||||||||||||||||||||||
| 2211 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||||||||
| 2212 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||||||||||||||||||||
| 2213 | - | |||||||||||||||||||||||||||||||
| 2214 | int firstOkIdx = -1; | - | ||||||||||||||||||||||||||||||
| 2215 | for (int i = 0; i <= insertionIdx
| 20-59 | ||||||||||||||||||||||||||||||
| 2216 | if (visibleItems.at(i)->index + 1 != visibleItems.at(i + 1)->index
| 8-31 | ||||||||||||||||||||||||||||||
| 2217 | firstOkIdx = i + 1; | - | ||||||||||||||||||||||||||||||
| 2218 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||||||||||||||
| 2219 | } | - | ||||||||||||||||||||||||||||||
| 2220 | } executed 31 times by 1 test: end of blockExecuted by:
| 31 | ||||||||||||||||||||||||||||||
| 2221 | for (int i = 0; i < firstOkIdx
| 12-49 | ||||||||||||||||||||||||||||||
| 2222 | FxViewItem *nvItem = visibleItems.takeFirst(); | - | ||||||||||||||||||||||||||||||
| 2223 | addedItems->removeOne(nvItem); | - | ||||||||||||||||||||||||||||||
| 2224 | removeItem(nvItem); | - | ||||||||||||||||||||||||||||||
| 2225 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||||||||
| 2227 | } executed 49 times by 1 test: else {end of blockExecuted by:
| 49 | ||||||||||||||||||||||||||||||
| 2228 | for (int i = 0; i < count
| 195-5011 | ||||||||||||||||||||||||||||||
| 2229 | visibleAffected = true; | - | ||||||||||||||||||||||||||||||
| 2230 | FxViewItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
| 2231 | if (change.isMove()
| 142-4242 | ||||||||||||||||||||||||||||||
| 2232 | item->index = modelIndex + i; executed 432 times by 1 test: item->index = modelIndex + i;Executed by:
| 432 | ||||||||||||||||||||||||||||||
| 2233 | bool newItem = !item; | - | ||||||||||||||||||||||||||||||
| 2234 | if (!item
| 432-4384 | ||||||||||||||||||||||||||||||
| 2235 | item = createItem(modelIndex + i, QQmlIncubator::Synchronous); executed 4384 times by 3 tests: item = createItem(modelIndex + i, QQmlIncubator::Synchronous);Executed by:
| 4384 | ||||||||||||||||||||||||||||||
| 2236 | if (!item
| 0-4816 | ||||||||||||||||||||||||||||||
| 2237 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2238 | - | |||||||||||||||||||||||||||||||
| 2239 | visibleItems.insert(index, item); | - | ||||||||||||||||||||||||||||||
| 2240 | if (index == 0
| 499-4317 | ||||||||||||||||||||||||||||||
| 2241 | insertResult->changedFirstItem = true; executed 499 times by 3 tests: insertResult->changedFirstItem = true;Executed by:
| 499 | ||||||||||||||||||||||||||||||
| 2242 | if (change.isMove()
| 574-4242 | ||||||||||||||||||||||||||||||
| 2243 | - | |||||||||||||||||||||||||||||||
| 2244 | - | |||||||||||||||||||||||||||||||
| 2245 | if (newItem
| 0-432 | ||||||||||||||||||||||||||||||
| 2246 | movingIntoView->append(MovedItem(item, change.moveKey(item->index))); executed 32 times by 1 test: movingIntoView->append(MovedItem(item, change.moveKey(item->index)));Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 2247 | } executed 574 times by 1 test: else {end of blockExecuted by:
| 574 | ||||||||||||||||||||||||||||||
| 2248 | addedItems->append(item); | - | ||||||||||||||||||||||||||||||
| 2249 | if (transitioner
| 228-4014 | ||||||||||||||||||||||||||||||
| 2250 | item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true); executed 228 times by 2 tests: item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);Executed by:
| 228 | ||||||||||||||||||||||||||||||
| 2251 | else | - | ||||||||||||||||||||||||||||||
| 2252 | static_cast< executed 4014 times by 3 tests: FxListItemSG *>(item)->setPosition(pos, true);static_cast<FxListItemSG *>(item)->setPosition(pos, true);Executed by:
executed 4014 times by 3 tests: static_cast<FxListItemSG *>(item)->setPosition(pos, true);Executed by:
| 4014 | ||||||||||||||||||||||||||||||
| 2253 | } | - | ||||||||||||||||||||||||||||||
| 2254 | insertResult->sizeChangesAfterVisiblePos += item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 2255 | pos += item->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 2256 | ++index; | - | ||||||||||||||||||||||||||||||
| 2257 | } executed 4816 times by 3 tests: end of blockExecuted by:
| 4816 | ||||||||||||||||||||||||||||||
| 2258 | - | |||||||||||||||||||||||||||||||
| 2259 | if (0 < index
| 0-1145 | ||||||||||||||||||||||||||||||
| 2260 | FxViewItem *prevItem = visibleItems.at(index - 1); | - | ||||||||||||||||||||||||||||||
| 2261 | FxViewItem *item = visibleItems.at(index); | - | ||||||||||||||||||||||||||||||
| 2262 | if (prevItem->index != item->index - 1
| 23-663 | ||||||||||||||||||||||||||||||
| 2263 | int i = index; | - | ||||||||||||||||||||||||||||||
| 2264 | qreal prevPos = prevItem->position(); | - | ||||||||||||||||||||||||||||||
| 2265 | while (i < visibleItems.count()
| 23-87 | ||||||||||||||||||||||||||||||
| 2266 | FxListItemSG *nvItem = static_cast<FxListItemSG *>(visibleItems.takeLast()); | - | ||||||||||||||||||||||||||||||
| 2267 | insertResult->sizeChangesAfterVisiblePos -= nvItem->size() + spacing; | - | ||||||||||||||||||||||||||||||
| 2268 | addedItems->removeOne(nvItem); | - | ||||||||||||||||||||||||||||||
| 2269 | if (nvItem->transitionScheduledOrRunning()
| 2-85 | ||||||||||||||||||||||||||||||
| 2270 | nvItem->setPosition(prevPos + (nvItem->index - prevItem->index) * averageSize); executed 2 times by 1 test: nvItem->setPosition(prevPos + (nvItem->index - prevItem->index) * averageSize);Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 2271 | removeItem(nvItem); | - | ||||||||||||||||||||||||||||||
| 2272 | } executed 87 times by 1 test: end of blockExecuted by:
| 87 | ||||||||||||||||||||||||||||||
| 2273 | } executed 23 times by 1 test: end of blockExecuted by:
| 23 | ||||||||||||||||||||||||||||||
| 2274 | } executed 686 times by 2 tests: end of blockExecuted by:
| 686 | ||||||||||||||||||||||||||||||
| 2275 | } executed 1145 times by 3 tests: end of blockExecuted by:
| 1145 | ||||||||||||||||||||||||||||||
| 2276 | - | |||||||||||||||||||||||||||||||
| 2277 | updateVisibleIndex(); | - | ||||||||||||||||||||||||||||||
| 2278 | - | |||||||||||||||||||||||||||||||
| 2279 | return executed 1194 times by 3 tests: visibleAffected;return visibleAffected;Executed by:
executed 1194 times by 3 tests: return visibleAffected;Executed by:
| 1194 | ||||||||||||||||||||||||||||||
| 2280 | } | - | ||||||||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||||||||
| 2282 | void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) | - | ||||||||||||||||||||||||||||||
| 2283 | { | - | ||||||||||||||||||||||||||||||
| 2284 | (void)insertionResult;; | - | ||||||||||||||||||||||||||||||
| 2285 | - | |||||||||||||||||||||||||||||||
| 2286 | if (!transitioner
| 0-240 | ||||||||||||||||||||||||||||||
| 2287 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2288 | - | |||||||||||||||||||||||||||||||
| 2289 | int markerItemIndex = -1; | - | ||||||||||||||||||||||||||||||
| 2290 | for (int i=0; i<visibleItems.count()
| 0-4056 | ||||||||||||||||||||||||||||||
| 2291 | if (visibleItems.at(i)->index == afterModelIndex
| 240-3816 | ||||||||||||||||||||||||||||||
| 2292 | markerItemIndex = i; | - | ||||||||||||||||||||||||||||||
| 2293 | break; executed 240 times by 2 tests: break;Executed by:
| 240 | ||||||||||||||||||||||||||||||
| 2294 | } | - | ||||||||||||||||||||||||||||||
| 2295 | } executed 3816 times by 2 tests: end of blockExecuted by:
| 3816 | ||||||||||||||||||||||||||||||
| 2296 | if (markerItemIndex < 0
| 0-240 | ||||||||||||||||||||||||||||||
| 2297 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2298 | - | |||||||||||||||||||||||||||||||
| 2299 | const qreal viewEndPos = isContentFlowReversed()
| 0-240 | ||||||||||||||||||||||||||||||
| 2300 | qreal sizeRemoved = -removalResult.sizeChangesAfterVisiblePos | - | ||||||||||||||||||||||||||||||
| 2301 | - (removalResult.countChangeAfterVisibleItems * (averageSize + spacing)); | - | ||||||||||||||||||||||||||||||
| 2302 | - | |||||||||||||||||||||||||||||||
| 2303 | for (int i=markerItemIndex+1; i<visibleItems.count()
| 120-138 | ||||||||||||||||||||||||||||||
| 2304 | FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(i)); | - | ||||||||||||||||||||||||||||||
| 2305 | if (listItem->position() >= viewEndPos
| 18-102 | ||||||||||||||||||||||||||||||
| 2306 | break; executed 102 times by 1 test: break;Executed by:
| 102 | ||||||||||||||||||||||||||||||
| 2307 | if (!listItem->transitionScheduledOrRunning()
| 0-18 | ||||||||||||||||||||||||||||||
| 2308 | qreal pos = listItem->position(); | - | ||||||||||||||||||||||||||||||
| 2309 | listItem->setPosition(pos - sizeRemoved); | - | ||||||||||||||||||||||||||||||
| 2310 | listItem->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false); | - | ||||||||||||||||||||||||||||||
| 2311 | listItem->setPosition(pos); | - | ||||||||||||||||||||||||||||||
| 2312 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||||||||
| 2313 | } executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||||||||||||||||||||||||||
| 2314 | } executed 240 times by 2 tests: end of blockExecuted by:
| 240 | ||||||||||||||||||||||||||||||
| 2315 | QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj) | - | ||||||||||||||||||||||||||||||
| 2316 | { | - | ||||||||||||||||||||||||||||||
| 2317 | return executed 32708 times by 10 tests: new QQuickListViewAttached(obj);return new QQuickListViewAttached(obj);Executed by:
executed 32708 times by 10 tests: return new QQuickListViewAttached(obj);Executed by:
| 32708 | ||||||||||||||||||||||||||||||
| 2318 | } | - | ||||||||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||||||||
| 2320 | - | |||||||||||||||||||||||||||||||
| 2321 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |