PDA

View Full Version : Moving multiple QGraphicItems



StefanHirche
11th January 2007, 20:13
Hi.
I want to move multiple QGraphicsItems, but with some boundary conditions.

1.) I need to preserve the z-values of all items.
2.) I need to preserve the boundary of all items.
-> I can't use QGraphicsItemGroup, because as a shape of the group item I get a box around all items, but I need something like the union of all items shapes. Secondly I get a z-value of the group.
So I tried to use "selectable", and then selected all items to move together. That works quite nice, the z-values of the items are preserved and clicking on translucent areas of the items don't select the item. But every selected item gets a black border... I'm also not sure how to implement, that all items of one group are selected when I click on one item of the group.

I forgot, I use Qt4.2...

wysota
11th January 2007, 20:28
You can always subclass the group and reimplement the methods you wish to behave differently - that shouldn't be too hard.

StefanHirche
11th January 2007, 21:27
But what methods I have to rewrite. As QGraphicsItemGroup is a QGraphicsItem, there is a single z-Value. So basically I have to rewrite the painting stuff?
The shape thing may be a simple one, that's right.