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

QtQuick.Controls Menu allows to drag items through the menu

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6.0
    • Quick: Controls 2
    • None
    • macOs Ventura 13.6.6, MacBook Pro 2017, 15'', with Touch Bar
    • macOS

    Description

      Good day,

      I am trying to prevent an Item from being dragged through a Menu when the Menu is open. Currently, when the Item is dragged over the Menu, it can be dragged through the Menu's background, which is not the intended behavior.

      While trying different approaches to make it work, I noticed that if I add `dragHandler` to `background` and set it `target` to `null` and for `grabPermissions` to PointHandler.TakeOverForbidden, this will work with QtQuick.Controls Popup, but not  QtQuick.Controls Menu, although the Menu is inherited from the Popup, but the behavior is different from the Menu.

      Minimum reproduction code contains two Rectangles with DragHandlers `grabPermissions` set to `PointHandler.CanTakeOverFromItems` and `TabHandler` to  show Menu or Popup. Menu and Popup has DragHandler inside their backgrounds, and `grabPermissions` are set to `PointHandler.TakeOverForbidden` to prevent any propagation of events. Right clicking on red rectangle will show the Menu with MenuItems in it, and right clicking on purple Rectangle will show the Popup. 
      While Menu is visible is still possible to drag the red Rectangle underneath by dragging over the MenuItems, but while Popup is visible dragging is blocked, expected behavior.

      My question will be why is the behavior is different even though Menu is a Popup?

      P.S.: Added QML file with minimum reproduction code and screen recording.

      Attachments

        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
            duodargel.cordeperil Siarhei Darhel
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes