Search code examples
qtselectionqgraphicsitem

QGraphicsItem selection


Does a simple method exist to select part of a QGraphicsItem (like for a selection, with a dashed border for example), despite its position in the QGraphicsScene

I've found QGraphicsItem::ItemIsSelectable but it doesn't help me much.

Thx


Solution

  • You can't select a part of QGraphicsItem. You can select whole item. Usualy it will draw a dashed rectangle around itself when selected.

    You can select item by:

    QGraphicsItem::setSelected
    

    or

    QGraphicsScene::setSelectionArea