From dba16089b0a535dafc306b58028172813c0a3d94 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 11 Mar 2015 16:02:33 +0100 Subject: PathView: use qt.quick.itemview.lifecycle logging category It is the same for debugging delegate cycling in ListView. Task-number: QTBUG-42716 Change-Id: I54b83a25a5d8473c643cd326fe114317103bb24e Reviewed-by: J-P Nurmi --- src/quick/items/qquickpathview.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 352a939e1b..58605f79dd 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -35,6 +35,7 @@ #include "qquickpathview_p_p.h" #include "qquickwindow.h" #include "qquickflickablebehavior_p.h" //Contains flicking behavior defines +#include "qquicktext_p.h" #include #include @@ -52,6 +53,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle) + const qreal MinimumFlickVelocity = 75.0; inline qreal qmlMod(qreal x, qreal y) @@ -194,6 +197,7 @@ void QQuickPathViewPrivate::releaseItem(QQuickItem *item) { if (!item || !model) return; + qCDebug(lcItemViewDelegateLifecycle) << "release" << item; QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); itemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry); QQmlInstanceModel::ReleaseFlags flags = model->release(item); @@ -824,9 +828,11 @@ void QQuickPathViewPrivate::setOffset(qreal o) Q_Q(QQuickPathView); if (offset != o) { if (isValid() && q->isComponentComplete()) { + qreal oldOffset = offset; offset = qmlMod(o, qreal(modelCount)); if (offset < 0) offset += qreal(modelCount); + qCDebug(lcItemViewDelegateLifecycle) << o << "was" << oldOffset << "now" << offset; q->refill(); } else { offset = o; @@ -1891,10 +1897,18 @@ void QQuickPathView::refill() // first move existing items and remove items off path int idx = d->firstIndex; + qCDebug(lcItemViewDelegateLifecycle) << "firstIndex" << idx << "currentIndex" << d->currentIndex << "offset" << d->offset; QList::iterator it = d->items.begin(); while (it != d->items.end()) { qreal pos = d->positionOfIndex(idx); QQuickItem *item = *it; + if (lcItemViewDelegateLifecycle().isDebugEnabled()) { + QQuickText *text = qmlobject_cast(item); + if (text) + qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ": QQuickText" << text->objectName() << text->text().left(40); + else + qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ":" << item; + } if (pos < 1.0) { d->updateItem(item, pos); if (idx == d->currentIndex) { @@ -1907,7 +1921,7 @@ void QQuickPathView::refill() if (QQuickPathViewAttached *att = d->attached(item)) att->setOnPath(pos < 1.0); if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) { -// qDebug() << "release"; + qCDebug(lcItemViewDelegateLifecycle) << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache); d->releaseItem(item); if (it == d->items.begin()) { if (++d->firstIndex >= d->modelCount) { @@ -1942,7 +1956,7 @@ void QQuickPathView::refill() } qreal pos = d->positionOfIndex(idx); while ((d->isInBound(pos, startPos, 1.0 + d->mappedCache) || !d->items.count()) && d->items.count() < count+d->cacheSize) { -// qDebug() << "append" << idx; + qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << pos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); QQuickItem *item = d->getItem(idx, idx+1, pos >= 1.0); if (!item) { waiting = true; @@ -1967,7 +1981,7 @@ void QQuickPathView::refill() idx = d->modelCount - 1; pos = d->positionOfIndex(idx); while (!waiting && d->isInBound(pos, d->mappedRange - d->mappedCache, startPos) && d->items.count() < count+d->cacheSize) { -// qDebug() << "prepend" << idx; + qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << pos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); QQuickItem *item = d->getItem(idx, idx+1, pos >= 1.0); if (!item) { waiting = true; -- cgit v1.2.3