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

WA_TransparentForMouseEvents ignores children

    XMLWordPrintable

Details

    Description

      If a child of a widget obscures a parent widget, and that parent has the attribute WA_TransparentForMouseEvents set, mouse events that should be handled by the child widget are not directed to the child widget.

      I believe the issue is that WA_TransparentForMouseEvents is checked too soon in QWidgetPrivate::childAt_helper. Here is a context diff for a tested fix.

      ***************

          • 9580,9587 ****
            )) {
            if (ignoreChildrenInDestructor && w->data->in_destructor)
            continue;
      • if (w->testAttribute(Qt::WA_TransparentForMouseEvents))
      • continue;
        QPoint childPoint = w->mapFromParent(p);
        #ifdef Q_WS_MAC
        if (includeFrame && !w->geometry().contains(p))
          • 9580,9585 ----
            ***************
          • 9589,9594 ****
          • 9587,9594 ----
            #endif
            if (QWidget *t = w->d_func()->childAt_helper(childPoint, ignoreChildrenInDestructor))
            return t;
            + if (w->testAttribute(Qt::WA_TransparentForMouseEvents))
            + continue;
            // if WMouseNoMask is set the widget mask is ignored, if
            // the widget has no mask then the WMouseNoMask flag has no
            // effect

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            andrew.bell.ia@gmail.com Andrew Bell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes