Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.10.1
-
None
Description
when a MouseArea gets visible, it will check if it is under the mouse, in that cause it will generate and entered() signal (this happens in QQuickMouseArea::itemChange)
however, it calls QQuickItem::isUnderMouse which doesn't always return the correct value:
if the mouse cursor is over another qquickwindow of the same application, and the mousearea overflows its own window, the function will return true if the global mouse position is over the mousearea geometry mapped to global, even if is not over the proper window, but the other one.
Attached a minimal test case: there are two windows, they need to be put one adjacent the other, the one with the red rectangle at the left and the white one tiled at its right.
position the mouse on the right, white window but kindof near the red rectangle on the other window, and every time the red rectangle appears, it will print on the console that an entered() was triggered, while is not.
this because isUnderMouse does:
QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition;
return contains(mapFromScene(d->window->mapFromGlobal(cursorPos.toPoint())));
without checking d->window->geometry() actually contains cursorPos