Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.3.2
-
None
-
Linux
-
360fcf3a99d84b038326d05f8ea8718b40bff2c0
Description
Using the basic test below you can see that Item::contains( point ) always returns true:
import QtQuick 2.3 Rectangle { width: 400 height: 400 color: "green" Rectangle { id: block width: 50 height: 50 color: "red" anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: { var pnt = mapToItem( block, mouse.x, mouse.y ); console.log( "pnt x:", pnt.x, "y:", pnt.y ); if ( block.contains( pnt ) ) { console.log( "Inside" ); } else { console.log( "Outside" ); } } } }
Inside is always printed regardless of the input coordinate. Adding debug to QQuickItem::contains(const QPointF &point) const reveals that the input arg is being converted to QPointF(0, 0) before it arrives.