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

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

    XMLWordPrintable

    Details

    • Commits:
      79cde77f23358adbe57ab8ce08730d2de5bb1288 (qt/qtdeclarative/dev) 9ed9a14be80b377e6681db8076dce31316ded144 (qt/qtdeclarative/6.1)
    • Sprint:
      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

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes