Fix polishItems bug
updatePolish is not called for items which are not visible. However if a polish is scheduled, updatePolish has to be called when the item becomes eventually visible. This patch makes sure, that invisible items are not removed from the itemsToPolish list. Change-Id: I1ad929dc6de8e61edbd1c4df88ae5bc951979ff1 Reviewed-by: Ulf Hermann <ulf.hermann@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
093fe73f91
commit
01e609e9fa
|
@ -246,23 +246,27 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev)
|
|||
d->updateFocusItemTransform();
|
||||
}
|
||||
|
||||
|
||||
void QQuickWindowPrivate::polishItems()
|
||||
{
|
||||
int maxPolishCycles = 100000;
|
||||
|
||||
while (!itemsToPolish.isEmpty() && --maxPolishCycles > 0) {
|
||||
int removedItems;
|
||||
do {
|
||||
removedItems = 0;
|
||||
QSet<QQuickItem *> itms = itemsToPolish;
|
||||
itemsToPolish.clear();
|
||||
|
||||
for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) {
|
||||
QQuickItem *item = *it;
|
||||
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
|
||||
itemPrivate->polishScheduled = false;
|
||||
if (item->isVisible() || (itemPrivate->extra.isAllocated() && itemPrivate->extra->effectRefCount>0))
|
||||
|
||||
if (item->isVisible() || (itemPrivate->extra.isAllocated() && itemPrivate->extra->effectRefCount>0)) {
|
||||
itemPrivate->polishScheduled = false;
|
||||
itemsToPolish.remove(item);
|
||||
item->updatePolish();
|
||||
++removedItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (removedItems > 0 && --maxPolishCycles > 0);
|
||||
|
||||
if (maxPolishCycles == 0)
|
||||
qWarning("QQuickWindow: possible QQuickItem::polish() loop");
|
||||
|
|
Loading…
Reference in New Issue