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

Make HoverHandler behaviour more well-defined

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None
    • Windows 10 21H2, MSVC 2019 x64

    Description

      HoverHandler behaviour – especially how it interacts with other mouse handlers – has changed somewhat frequently across versions. It is not clear which change is a regression, which change is a bugfix, and which change is simply due to undefined behaviour.

      It would be helpful make the behaviour more well-defined and better documented, so that developers know what to expect and how to use it correctly.

       

      Test app

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 800
          height: 600
          visible: true
      
          Column {
              anchors.fill: parent
              topPadding: 50
      
              Rectangle {
                  width: parent.width
                  height: 400
                  color: "lightblue"
      
                  ListView {
                      id: view
                      anchors.fill: parent
      
                      model: 5
                      spacing: 2
                      delegate: Rectangle {
                          height: view.height / 6
                          width: height
                          anchors.horizontalCenter: parent.horizontalCenter
                          color: "orange"
                      }
      
                      HoverHandler { id: hoverHandler }
      
                      Rectangle {
                          anchors.centerIn: parent
                          width: parent.width / 3
                          height: parent.height / 3
                          color: "darkgreen"
      
                          MouseArea {
                              id: innerMouseArea
                              anchors.fill: parent
                              hoverEnabled: true
                          }
                      }
                  }
              }
      
              CheckBox {
                  text: "HoverHandler hovered?"
                  checked: hoverHandler.hovered
              }
              CheckBox {
                  text: "MouseArea hovered?"
                  checked: innerMouseArea.containsMouse
              }
          }
      }
      
      

       

      Test steps

      1. Place your mouse cursor at the center-top of the window, in the white region
      2. Move your mouse cursor downwards, along the orange column
      3. Move your mouse cursor downwards, into the green rectangle
      4. Click on the green rectangle
      5. Move your mouse cursor downwards, out of the green rectangle into the lower orange column
      6. Move your mouse cursor downwards, out of the orange column into the blue background
      7. Move your mouse cursor downwards, out of the blue rectange into the white region

       

      Results: HoverHandler hovered?

      Numerous differences between versions:

      Step Qt 5.15.2 Qt 5.15.10 Qt 6.2+
      1      
      2
      3    
      4  
      5
      6    
      7      

       

      Results: MouseArea hovered?

      Consistent behaviour between verisons:

      Step Qt 5.15.2 Qt 5.15.10 Qt 6.2+
      1      
      2      
      3
      4
      5      
      6      
      7      

      (Qt 6.2+ means the behaviour is the same in Qt 6.2.5, 6.3.2, and 6.4.0-RC1)

      Attachments

        Issue Links

          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
              skoh-qt Sze Howe Koh
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes