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

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

    XMLWordPrintable

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

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes