QGraphicsScene: replace QList::prepend()s with appends()

Use the new reverse_iterator support in QList to
avoid building a QList with prepend()ing, using
append() instead.

Change-Id: Ia1f6d0ecc08a824f11d93a6fd4077b11b1b0f786
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Marc Mutz 2015-12-16 14:25:21 +01:00
parent bb7bc4a05e
commit 46ed6c058a

View File

@ -3870,15 +3870,15 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
QList<QGraphicsItem *> parents; QList<QGraphicsItem *> parents;
QGraphicsItem *parent = item; QGraphicsItem *parent = item;
while (parent && parent != commonAncestorItem) { while (parent && parent != commonAncestorItem) {
parents.prepend(parent); parents.append(parent);
if (parent->isPanel()) { if (parent->isPanel()) {
// Stop at the panel - we don't deliver beyond this point. // Stop at the panel - we don't deliver beyond this point.
break; break;
} }
parent = parent->parentItem(); parent = parent->parentItem();
} }
for (int i = 0; i < parents.size(); ++i) { for (auto it = parents.crbegin(), end = parents.crend(); it != end; ++it) {
parent = parents.at(i); QGraphicsItem *parent = *it;
hoverItems << parent; hoverItems << parent;
if (itemAcceptsHoverEvents_helper(parent)) if (itemAcceptsHoverEvents_helper(parent))
sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent);