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

QQuickItem API that involves item-at/bounds checks doesn't respect containmentMask

    XMLWordPrintable

Details

    • 10e4dcc0cf8141f896829e999402ad78591533b3 (qt/qtdeclarative/dev) 6d332987ef5525f0b673e858ddd5b506ff87c231 (qt/qtdeclarative/6.2)

    Description

      QQuickItem API that involves coordinates of children or bounds tests in general should use containmentMask.

      For example, QQuickItem::childAt():

      diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
      index ccd1168278..f849361634 100644
      --- a/src/quick/items/qquickitem.cpp
      +++ b/src/quick/items/qquickitem.cpp
      @@ -4820,10 +4820,7 @@ QQuickItem *QQuickItem::childAt(qreal x, qreal y) const
               QQuickItem *child = children.at(i);
               // Map coordinates to the child element's coordinate space
               QPointF point = mapToItem(child, QPointF(x, y));
      -        if (child->isVisible() && point.x() >= 0
      -                && child->width() > point.x()
      -                && point.y() >= 0
      -                && child->height() > point.y())
      +        if (child->contains(point))
                   return child;
           }
           return nullptr;
      

      Attachments

        Issue Links

          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
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes