How to avoid movility on a QGraphicsItem when it's selected?



  • I've two custom classes from QGraphicsItem that it's drawn on a custom QGraphicsScene. One of them is selectable:

    @
    //Inicialize all data TYPE A
    this->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    (...)
    @

    @
    //Inicialize all data TYPE B
    this->setFlags(QGraphicsItem::ItemIsMovable);
    (...)
    @

    The other one is just movable. Ok, then, when the selectable A object is selected (it shows an arrow when it is, drawn in its paint method) and I try to drag an object of the other type ("just movable type", type B), the selected object is also dragged. Only if I deselect it, I can drag only the B object.

    What can I do to indicate to Qt to move only if the mouse is clicked on the object?

    Thank you.


Log in to reply