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

containsMouse property not updated correctly for overlapping mouse areas during dragging

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.2.0, 6.4.0 Beta4
    • None
    • Windows 7 64 bit

    Description

      If two mouse areas overlap and the mouse area in the back has hoverEnabled set to true, its containsMouse property will not update while dragging when the mouse has been pressed on the front mouse area. It will only update after releasing the mouse and moving it again. The same it true for onEntered and onExited signals.

      Here is an example that demonstrates the problem:

      import QtQuick 2.2
      import QtTest 1.0
      
      Item {
          id: scene
          width: 300
          height: 300
      
          MouseArea {
              id: mouseAreaBack
              width:200; height:200; x: 50; y: 50
              hoverEnabled: true
          }
      
          MouseArea {
              id: mouseAreaFront
              width:100; height:100; x: 100; y: 100
          }
      
          TestCase {
              name: "OverlappingMouseAreas"
              when: windowShown
      
              function test_overlappingMouseArea(data) {
                  mouseMove(scene, 25, 150);
                  // move mouse over mouseAreaBack and mouseAreaFront
                  mouseMove(scene, 150, 150);
                  compare(mouseAreaBack.containsMouse, true); // <- PASS
                  // press within mouseAreaFront and drag the mouse out of mouseAreaBack and mouseAreaFront
                  mousePress(scene, 150, 150);
                  mouseMove(scene, 275, 150);
                  // not ok, we are outside of mouseAreaBack now
                  compare(mouseAreaBack.containsMouse, false); // <- FAIL
                  mouseRelease(scene, 275, 150);
                  // not ok after releasing the mouse
                  compare(mouseAreaBack.containsMouse, false); // <- FAIL
                  // moving the mouse a bit updates containsMouse
                  mouseMove(scene, 275 + 1, 150);
                  compare(mouseAreaBack.containsMouse, false); // <- PASS
              }
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              srutledg Shawn Rutledge
              che Carsten Henßinger
              Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes