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

Qt::IntersectsItemShape issue

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11
    • Widgets: GraphicsView
    • None
    • All

    Description

      The method

      QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const

      doesn't work always correctly using Qt::ItemSelectionMode mode = Qt::IntersectsItemShape.

      If you have a parent QGraphicsItem with the QGraphicsItem::ItemClipsChildrenToShape set, the QGraphicsScene::items doesn't use the Qt::IntersectsItemShape for the children items, but use the bounding rect of the items.

      Also the tooltip of the children items is shown when the mouse is over the bounding rect and not only over the shape.

      I have investigate the Qt code and I see that this appens because the intersection method doesn't not call QGraphicsItem::shape() method for the children item, but the QGrapihcsItem::clipShape(), that use only the bounding rect of the item if the QGraphicsItem::ItemClipsToShape is not set.

      A workaround is to set QGraphicsItem::ItemClipsToShape for all the children items, but I know that this can cause performance issues. This should not be necessary because my children items don't draw outside of their shape.

       

      Attachments

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

        Activity

          People

            bibr Andreas Aardal Hanssen
            puffosauro Fabio Dago
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes