diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-16 14:25:21 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-17 16:48:05 +0000 |
commit | 46ed6c058ae0eebd1e52a5e64b04845eca2162f4 (patch) | |
tree | d918769e5c88c27aee361c4e94a2c2acaefa81f3 /src/widgets | |
parent | bb7bc4a05ef219238839d03259f6da7543377e0a (diff) |
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>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index df810064c7..77bc8d4fcd 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -3870,15 +3870,15 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv QList<QGraphicsItem *> parents; QGraphicsItem *parent = item; while (parent && parent != commonAncestorItem) { - parents.prepend(parent); + parents.append(parent); if (parent->isPanel()) { // Stop at the panel - we don't deliver beyond this point. break; } parent = parent->parentItem(); } - for (int i = 0; i < parents.size(); ++i) { - parent = parents.at(i); + for (auto it = parents.crbegin(), end = parents.crend(); it != end; ++it) { + QGraphicsItem *parent = *it; hoverItems << parent; if (itemAcceptsHoverEvents_helper(parent)) sendHoverEvent(QEvent::GraphicsSceneHoverEnter, parent, hoverEvent); |