[Qt-interest] SOLVED: About QGraphicsItemGroup

Johannes Kleimola johannes at kleimola.fi
Thu Mar 25 15:46:12 CET 2010


I seem to have missed something in my initial attempts, since a new try 
with a subclassed QGraphicsItemGroup with just an empty paint function 
worked now. Maybe I missed something from that I need to create the 
group with 'new', not define any UserType type() and I also need to 
manually add the group to the scene with addItem. Oh well...

Johannes Kleimola wrote:
> 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