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

QApplication::widgetAt() doesn't work with widgets with Qt::WA_TransparentForMouseEvents on Mac

    XMLWordPrintable

Details

    • macOS
    • 189f9873a (dev), d6cc0fbd5 (6.6), cd8f7a761 (tqtc/lts-6.5)

    Description

      On the Mac, calling QApplication::widgetAt() with a point over a Qt::Tool widget with WA_TransparentForMouseEvents attribute set doesn't properly return the widget underneath it. Instead it returns null. On Windows, this works as expected by returning the widget underneath the tool widget.

      QApplication::widgetAt() uses a mask to cut a hole in the widget for the cursor point and tries calling widgetAt() again with the mask applied. This doesn't appear to work properly on the Mac and ultimately returns null. In general, cutting a hole using a mask on the Mac does work as shown in the attached test app but is not working as desired in widgetAt().

      I've attached a sample app that shows the problem. See the source code for details.

      For context, I am using a widget with the Qt::Tool flag as a custom drag and drop feedback widget. However, this bug prevents me from determining the appropriate widget beneath the Qt::Tool widget to perform the drop on.

      Attachments

        Issue Links

          Activity

            People

              vestbo Tor Arne Vestbø
              dpace David Pace
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              5 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: