In my app I am using the Graphics View framework and I am creating a lot of QGraphicsItemGroup. For example one group represents a text frame with some squares to resize the frame and another is a group of points representing a brush stroke. I am implementing a selection tool similar to the one you can find in Adobe Photoshop or Indesign. I implemented it as follow:
- In my scene I use the function itemAt(pos, transform) with pos being the current position of my mouse.
- Plus I called setFiltersChildEvents(True) in all the groups
However the item returned by itemAt is sometimes just a child of the group itself. Is there a way to make the function itemAt() returning the group of the item ? Or in another way, to make those children unselectable.
If you are looking to get the group of the item
Below method available for
QGraphicsItem
, which returnsQGraphicsItemGroup
. Use this group object and set the desired.https://doc.qt.io/qtforpython/PySide6/QtWidgets/QGraphicsItem.html?highlight=qgraphicsitem#PySide6.QtWidgets.PySide6.QtWidgets.QGraphicsItem.group