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

MouseArea falsely reports hover when it recieves a right click

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future release
    • 5.2.0, 6.5
    • None
    • Ubuntu 13.04 x64, stock g++, Intel core i3 2xxx CPU & GPU

    Description

      Check out these two examples (also linked)

      below, moving the mouse across the area in the center does not make the root area stop reporting hover:

      import QtQuick 2.0
      
      MouseArea {
          width: 600
          height: 600
      
          hoverEnabled: true
      
          Rectangle {
              anchors.fill: parent
              color: parent.containsMouse? "red": "blue"
          }
          MouseArea {
              anchors.fill: parent
              anchors.margins: 150
              hoverEnabled: true
      
              Rectangle {
                  anchors.fill: parent
                  color: parent.containsMouse? "red": "blue"
                  border.width: 1
              }
          }
      }
      

      below, right-clicking (and only right-clicking, as left behaves ok) on the area underneath through the on top, makes the one underneath report hover:

      import QtQuick 2.0
      
      Rectangle {
          width: 600
          height: 600
      
          Rectangle {
              width: 200
              height: 200
              border.width: 1
              color: area1.containsMouse? "red": "blue"
      
              MouseArea {
                  id: area1
                  anchors.fill: parent
                  hoverEnabled: true
                  acceptedButtons: Qt.LeftButton | Qt.RightButton
                  onClicked: {
                      console.log("click!")
                  }
              }
          }
          Rectangle {
              x: 100
              y: 100
              width: 200
              height: 200
              border.width: 1
              color: area2.containsMouse? "red": "blue"
      
              MouseArea {
                  id: area2
                  anchors.fill: parent
                  hoverEnabled: true
              }
          }
      }
      

      Attachments

        1. tst_hover_bug.qml
          0.4 kB
          Vladimir M.
        2. tst_hover_bug_2.qml
          0.7 kB
          Vladimir M.
        3. tst_doc.qml
          0.7 kB
          Vladimir M.
        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
            mlvljr Vladimir M.
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes