Selection in action

Though saving for all entities has been done yesterday but no ids were assigned to any of the saved entities. Continuing it, we have assigned a unique id(duh 😉 ) to each entity in the scene. Pre-increment came into action.

Then we started with selection and moving of entities. It worked decently for point but lost its expected behavior with other entities. Considering line say, it is constructed using two points and a path joining them. If the mouse click was on path say, or any of the one points, voila only the path or the point selected moved and the remaining part of the entity did not bother to accompany. And we laughed!

Learnt another element of Qt namely QGraphicsItemGroup. We created groups for each of the entities. Added the entities’ different parts to this group and then this group was added to the scene just like single QGraphicsItem was done. Got the selection accomplished. The issue of overlapping entities is also solved to an acceptable level according to me but not Gurjot. 😀 We are trying to minimize the bounding rectangle for the entities, considering shape() to be of some convenience.

Leave a Reply