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

HoverHandler: sometimes point.position returns (0, 0)

    XMLWordPrintable

Details

    • 79cde77f23358adbe57ab8ce08730d2de5bb1288 (qt/qtdeclarative/dev) 9ed9a14be80b377e6681db8076dce31316ded144 (qt/qtdeclarative/6.1), 7b8bea13e (dev), 07e0138fa (6.7), 1c7ada23e (6.6), 75512d6cd (tqtc/lts-6.5), c79309ed7 (tqtc/lts-6.2)
    • Bug Fixing Candidates

    Description

      In the following example, if you click somewhere in the window to open a popup menu, the hoverhandler position becomes (0, 0). This is annoying, since if you try to position e.g and item according to this position, that item will also jump to 0, 0 when the menu opens.

      import QtQuick 2.15
      import QtQuick.Window 2.1
      import QtQuick.Controls 2.15
      import Qt.labs.qmlmodels 1.0
      
      Window {
          id: root
          width: 800
          height: 600
          visible: true
          visibility: Window.AutomaticVisibility
      
          Rectangle {
              anchors.fill: parent
      
              HoverHandler {
                  onPointChanged: {
                      var pos = point.position
                      if (pos === Qt.point(0, 0))
                          print("hover position is 0, 0!")
                  }
              }
      
              TapHandler {
                  onTapped: contextMenu.popup(point.position)
              }
      
              Menu {
                  id: contextMenu
                  modal: true
                  MenuItem { text: "Foo" }
                  MenuItem { text: "Bar" }
                  MenuItem { text: "Baz" }
              }
          }
      }
       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-83980
          # Subject Branch Project Status CR V

          Activity

            People

              richard Richard Moe Gustavsen
              richard Richard Moe Gustavsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: