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

Popup propagates TapHandler/DragHandler events

XMLWordPrintable

    • All

      Different Pointer Handler combinations with Popup can "pass through" events. Example:

      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 800
          height: 600
          visible: true
      
          Rectangle {
              width: 200
              height: 30
              color: "yellow"
              Text { text: "Destroy World" }
              TapHandler { onTapped: console.log("BOOM"); }
          }
      
          Popup {
              id: popup
              x: 50
              width: 100
              height: 100
              modal: true
              focus: true
              Component.onCompleted: {
                  popup.open();
              }
      
              Rectangle {
                  width: 80
                  height: 30
                  color: "green"
                  Text { text: "Do someting" }
                  TapHandler { onTapped: console.log("ok"); }
              }
      //        Rectangle {
      //            width: 80
      //            height: 30
      //            color: "green"
      //            DragHandler {}
      //        }
          }
      } 

       

      In this example both onTapped will be triggered. I know that it can be solved with TapHandler.ReleaseWithinBounds, but it is hack that works in only this specific case and only if I control all the TapHandlers. And if I need to use other gesturePolicy, then it wont work.

      Also event is passed through if there is DragHandler in popup. 

      This is very dangerous and makes PointerHandlers useless.

      Please implement Item.modal feature ASAP QTBUG-68103

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

            srutledg Shawn Rutledge
            chocis Janis Coders
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes