29{
30 if (!parent) return nullptr;
31 QList<QQuickItem *> children = QQuickItemPrivate::get(parent)->paintOrderChildItems();
32
33 for (int i = children.count() - 1; i >= 0; --i) {
34 QQuickItem *child = children.at(i);
35
36
37 QPointF point = parent->mapToItem(child, QPointF(x, y));
38 if (child->isVisible() && point.x() >= 0
39 && child->width() >= point.x()
40 && point.y() >= 0
41 && child->height() >= point.y()) {
42 if (!matcher.isCallable()) return child;
43
44 QQmlEngine* engine = qmlEngine(child);
45 if (!engine) return child;
46
47 QJSValue newObj = engine->newQObject(child);
48 if (matcher.call(QJSValueList() << newObj).toBool()) {
49 return child;
50 }
51 }
52 }
53 return nullptr;
54}