Provides a wrapper that bypasses the restriction that QGraphicsItem::setSelected() is not virtual
The selection management of umbrello uses a virtual method setSelected() for selection to achieve the desired behavior in the different derivation levels regarding selection and deselection.
Within QGraphicsScene, QGraphicsItem::setSelected() is called to manage the selection state, e.g. with clearSelection(), but unfortunately cannot be directly overwritten by umbrello because this method is not virtual (I consider this a design flaw).
Fortunately there is a workaround for the problem by using QGraphicsItem::itemChange(), which is overridden in this class and calls the (now) virtual method setSelected() when the selection state changes. This calls derived implementations of this method and realizes the desired behavior.
Within setSelected() you have to take care that QGraphicsObject::setSelected() is not called if the call came from itemChange() to avoid an endless loop.
- Author
- Ralf Habacker ralf..nosp@m.haba.nosp@m.cker@.nosp@m.free.nosp@m.net.d.nosp@m.e