Removed unnecessary qobject_cast in QSGItem::childAt
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Fri, 10 Jun 2011 15:54:29 +0000 (17:54 +0200)
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
Thu, 23 Jun 2011 14:34:45 +0000 (16:34 +0200)
No point in casting a QSGItem to a QSGItem and checking whether it
really was one.

Change-Id: Iaa82e1cb62f801f456b9020c4d410c13bfd3a9ea
Reviewed-by: Gunnar Sletta

src/declarative/items/qsgitem.cpp

index 3b07503..aa8fec7 100644 (file)
@@ -1879,13 +1879,12 @@ QSGItem *QSGItem::childAt(qreal x, qreal y) const
     // XXX todo - should this include transform etc.?
     const QList<QSGItem *> children = childItems();
     for (int i = children.count()-1; i >= 0; --i) {
-        if (QSGItem *child = qobject_cast<QSGItem *>(children.at(i))) {
-            if (child->isVisible() && child->x() <= x
+        QSGItem *child = children.at(i);
+        if (child->isVisible() && child->x() <= x
                 && child->x() + child->width() >= x
                 && child->y() <= y
                 && child->y() + child->height() >= y)
-                return child;
-        }
+            return child;
     }
     return 0;
 }