From 1dd8b509074ba60da671f7671f8cf09c3fc001ae Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 30 Aug 2011 16:02:41 +1000 Subject: [PATCH] Remove scheduleLayout() and layoutScheduled No longer necessary since views now call QSGItem::polish() which does its own layout scheduling and only does layouts when necessary Change-Id: I7d265fcf4177344c4ba10600b551a5545284316f Reviewed-on: http://codereview.qt.nokia.com/3843 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Jones --- src/declarative/items/qsggridview.cpp | 2 +- src/declarative/items/qsgitemview.cpp | 20 +++++--------------- src/declarative/items/qsgitemview_p_p.h | 2 -- src/declarative/items/qsglistview.cpp | 2 +- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp index f095636..50ea86a 100644 --- a/src/declarative/items/qsggridview.cpp +++ b/src/declarative/items/qsggridview.cpp @@ -774,7 +774,7 @@ void QSGGridViewPrivate::itemGeometryChanged(QSGItem *item, const QRectF &newGeo if (item == q) { if (newGeometry.height() != oldGeometry.height() || newGeometry.width() != oldGeometry.width()) { updateViewport(); - scheduleLayout(); + q->polish(); } } } diff --git a/src/declarative/items/qsgitemview.cpp b/src/declarative/items/qsgitemview.cpp index c28fbb1..cd598e9 100644 --- a/src/declarative/items/qsgitemview.cpp +++ b/src/declarative/items/qsgitemview.cpp @@ -786,7 +786,7 @@ void QSGItemView::itemsInserted(int index, int count) d->currentChanges.prepare(d->currentIndex, d->itemCount); d->currentChanges.doInsert(index, count); - d->scheduleLayout(); + polish(); } void QSGItemView::itemsRemoved(int index, int count) @@ -797,7 +797,7 @@ void QSGItemView::itemsRemoved(int index, int count) d->currentChanges.prepare(d->currentIndex, d->itemCount); d->currentChanges.doRemove(index, count); - d->scheduleLayout(); + polish(); } void QSGItemView::itemsMoved(int from, int to, int count) @@ -811,7 +811,7 @@ void QSGItemView::itemsMoved(int from, int to, int count) d->currentChanges.prepare(d->currentIndex, d->itemCount); d->currentChanges.doMove(from, to, count); - d->scheduleLayout(); + polish(); } void QSGItemView::itemsChanged(int index, int count) @@ -822,7 +822,7 @@ void QSGItemView::itemsChanged(int index, int count) d->currentChanges.prepare(d->currentIndex, d->itemCount); d->currentChanges.doChange(index, count); - d->scheduleLayout(); + polish(); } void QSGItemView::modelReset() @@ -1166,7 +1166,7 @@ QSGItemViewPrivate::QSGItemViewPrivate() , headerComponent(0), header(0), footerComponent(0), footer(0) , minExtent(0), maxExtent(0) , ownModel(false), wrap(false), lazyRelease(false), deferredRelease(false) - , layoutScheduled(false), inApplyModelChanges(false), inViewportMoved(false), forceLayout(false), currentIndexCleared(false) + , inApplyModelChanges(false), inViewportMoved(false), forceLayout(false), currentIndexCleared(false) , haveHighlightRange(false), autoHighlight(true), highlightRangeStartValid(false), highlightRangeEndValid(false) , minExtentDirty(true), maxExtentDirty(true) { @@ -1406,15 +1406,6 @@ void QSGItemViewPrivate::regenerate() } } -void QSGItemViewPrivate::scheduleLayout() -{ - Q_Q(QSGItemView); - if (!layoutScheduled) { - layoutScheduled = true; - q->polish(); - } -} - void QSGItemViewPrivate::updateViewport() { Q_Q(QSGItemView); @@ -1429,7 +1420,6 @@ void QSGItemViewPrivate::updateViewport() void QSGItemViewPrivate::layout() { Q_Q(QSGItemView); - layoutScheduled = false; if (!isValid() && !visibleItems.count()) { clear(); setPosition(contentStartPosition()); diff --git a/src/declarative/items/qsgitemview_p_p.h b/src/declarative/items/qsgitemview_p_p.h index e2e222b..2430455 100644 --- a/src/declarative/items/qsgitemview_p_p.h +++ b/src/declarative/items/qsgitemview_p_p.h @@ -126,7 +126,6 @@ public: void layout(); void refill(); void refill(qreal from, qreal to, bool doBuffer = false); - void scheduleLayout(); void mirrorChange(); FxViewItem *createItem(int modelIndex); @@ -184,7 +183,6 @@ public: bool wrap : 1; bool lazyRelease : 1; bool deferredRelease : 1; - bool layoutScheduled : 1; bool inApplyModelChanges : 1; bool inViewportMoved : 1; bool forceLayout : 1; diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp index 82a2dd7..73bbd87 100644 --- a/src/declarative/items/qsglistview.cpp +++ b/src/declarative/items/qsglistview.cpp @@ -1037,7 +1037,7 @@ void QSGListViewPrivate::itemGeometryChanged(QSGItem *item, const QRectF &newGeo if ((orient == QSGListView::Vertical && newGeometry.height() != oldGeometry.height()) || (orient == QSGListView::Horizontal && newGeometry.width() != oldGeometry.width())) { forceLayout = true; - scheduleLayout(); + q->polish(); } } } -- 2.7.4