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

A disabled MouseArea will still steal but not receive position changes if hoverEnabled is set to true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.0.0, 5.4.0 RC
    • None

      In the code below, the second MouseArea shouldn't steal any events, but it does steal hover events. Strangely though, it doesn't receive position changes, it just prevents other MouseAreas below it from receiving hover events.

      import QtQuick 2.0
      
      Item {
          width: 400
          height: 400
      
          MouseArea {
              anchors.fill: parent
              hoverEnabled: true
              onClicked: print("clicked")
              onPressed: print("pressed")
              onReleased: print("released")
              onPositionChanged: print("position", mouse.x, mouse.y)
          }
      
          MouseArea {
              enabled: false
              onEnabledChanged: print("blocking mouse area", enabled ? "enabled" : "disabled")
              hoverEnabled: true
              onPositionChanged: print("blocking mouse area position changed", mouse.x, mouse.y)
              // Workaround:
      //        hoverEnabled: enabled
              anchors.fill: parent
              onClicked: currentMenu = -1
          }
      }
      

      A workaround is to set hoveredEnabled to the enabled property.

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

            richard Richard Moe Gustavsen
            mitch_curtis Mitch Curtis
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes