[Qt-interest] About QGraphicsItemGroup

Johannes Kleimola johannes at kleimola.fi
Thu Mar 25 13:43:20 CET 2010


Resending to create a new thread. Sorry about templating using reply on 
another thread.

Hi!

I'm trying to control grouping of QGraphicItems on a QGraphicsScene with 
QGraphicsItemGroup. I want to achieve that dragging any of the items in 
a group will move the whole group and select all the items. With pure 
parent-child relationship dragging the child will change its position 
relative to parent in the normal case, while QGraphicsItemGroup handles 
all items "as one". The problem with QGraphicsItemGroup is only that 
since I would like to make all in the items in group selectable and 
selected when dragging (for alternative painting purposes) 
QGraphicsItemGroup draws an unwanted black rectangle around the items 
(boundingrect) if QGraphicsItem::ItemIsSelectable is enabled on the 
group. Leaving that flag away prevents dispatching selection status to 
items within group even though they have the flag enabled. I tried to 
subclass QGraphcisItemGroup with an empty overloaded paint function, but 
it did not help. Is there a way or do I have to implement my own 
selected state variable into items and leave the 
QGraphicsItem::ItemIsSelectable from QGraphicsItemGroup and maybe from 
the items too?

Thank you,

  >> Johannes <<

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Qt-interest-old mailing list