QGraphicsScene: don't search for nullptr

Following f6cb8b1af8, take
advantage of the nullptr return case of QGraphicsItem
::toGraphicsObject() by not looking up nullptr in the
QList and the two QHashes. They don't contain nullptrs.

Change-Id: Ic1cfbb4c60061577a09348ef78fdc573f95ad9a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Marc Mutz 2016-09-21 09:12:24 +02:00
parent 82eb7d1537
commit 8e45fe6d6c
1 changed files with 5 additions and 4 deletions

View File

@ -710,10 +710,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
++it;
}
QGraphicsObject *dummy = item->toGraphicsObject();
cachedTargetItems.removeOne(dummy);
cachedItemGestures.remove(dummy);
cachedAlreadyDeliveredGestures.remove(dummy);
if (QGraphicsObject *dummy = item->toGraphicsObject()) {
cachedTargetItems.removeOne(dummy);
cachedItemGestures.remove(dummy);
cachedAlreadyDeliveredGestures.remove(dummy);
}
foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys())
ungrabGesture(item, gesture);