Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-66907

QQuickWidget::isUnderMouse returns true when the cursor is out of the window


    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.10.1
    • Fix Version/s: None
    • Labels:


      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


        1. mouseoverbug.qml
          0.6 kB
        2. bug.png
          11 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              notmart Marco Martin
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes